MCPcopy Create free account
hub / github.com/SimpleITK/SimpleITK / SetCallbackPyCallable

Method SetCallbackPyCallable

Wrapping/Python/sitkPyCommand.cxx:65–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65void
66PyCommand::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
89PyObject *
90PyCommand::GetCallbackPyCallable()

Callers 1

Calls

no outgoing calls

Tested by 1