| 63 | } |
| 64 | |
| 65 | void |
| 66 | PyCommand::SetCallbackPyCallable(PyObject * o) |
| 67 | { |
| 68 | if (o != this->m_Object) |
| 69 | { |
| 70 | PyGILStateEnsure gil; |
| 71 | if (this->m_Object) |
| 72 | { |
| 73 | // get rid of our reference |
| 74 | Py_DECREF(this->m_Object); |
| 75 | } |
| 76 | |
| 77 | // store the new object |
| 78 | this->m_Object = o; |
| 79 | |
| 80 | if (this->m_Object) |
| 81 | { |
| 82 | // take out reference (so that the calling code doesn't |
| 83 | // have to keep a binding to the callable around) |
| 84 | Py_INCREF(this->m_Object); |
| 85 | } |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | PyObject * |
| 90 | PyCommand::GetCallbackPyCallable() |
no outgoing calls