7 #if PY_VERSION_HEX >= 0x03000000 9 #define PyMethod_GET_CLASS( meth ) Py_None 36 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES |
38 (
char*)
"PyROOT float object for pass by reference",
63 #if PY_VERSION_HEX >= 0x02030000 66 #if PY_VERSION_HEX >= 0x02060000 69 #if PY_VERSION_HEX >= 0x03040000 95 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES |
97 (
char*)
"PyROOT long object for pass by reference",
122 #if PY_VERSION_HEX >= 0x02030000 125 #if PY_VERSION_HEX >= 0x02060000 128 #if PY_VERSION_HEX >= 0x03040000 136 #ifndef PyMethod_MAXFREELIST 137 #define PyMethod_MAXFREELIST 256 141 #
if PY_VERSION_HEX < 0x03000000
149 if ( ! PyCallable_Check( func ) ) {
150 PyErr_Format( PyExc_SystemError,
151 "%s:%d: bad argument to internal function",
152 __FILE__, __LINE__ );
158 free_list = (PyMethodObject*)( im->im_self );
167 im->im_weakreflist = NULL;
172 #if PY_VERSION_HEX < 0x03000000 173 Py_XINCREF( pyclass );
174 im->im_class = pyclass;
176 PyObject_GC_Track( im );
186 PyObject_GC_UnTrack( im );
188 if ( im->im_weakreflist != NULL )
189 PyObject_ClearWeakRefs( (
PyObject*) im );
191 Py_DECREF( im->im_func );
192 Py_XDECREF( im->im_self );
193 #if PY_VERSION_HEX < 0x03000000 194 Py_XDECREF( im->im_class );
214 PyObject*
self = PyMethod_GET_SELF( meth );
220 PyObject* pyclass = PyMethod_GET_CLASS( meth );
221 if ( 1 <= argc && PyObject_IsInstance( PyTuple_GET_ITEM( args, 0 ), pyclass ) == 1 ) {
222 self = PyTuple_GET_ITEM( args, 0 );
224 PyObject* newArgs = PyTuple_New( argc - 1 );
225 for (
int i = 1; i < argc; ++i ) {
226 PyObject*
v = PyTuple_GET_ITEM( args, i );
228 PyTuple_SET_ITEM( newArgs, i-1, v );
234 return PyMethod_Type.tp_call( meth, args, kw );
239 PyCFunctionObject* func = (PyCFunctionObject*)PyMethod_GET_FUNCTION( meth );
257 if ( PyMethod_GET_SELF( meth ) != NULL
258 #
if PY_VERSION_HEX < 0x03000000
259 || ( PyMethod_GET_CLASS( meth ) != NULL &&
260 ! PyObject_IsSubclass( pyclass, PyMethod_GET_CLASS(meth) ) )
267 if ( obj == Py_None )
276 (
char*)
"ROOT.InstanceMethod",
294 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES |
296 (
char*)
"PyROOT custom instance method (internal)",
321 #
if PY_VERSION_HEX >= 0x02030000
324 #
if PY_VERSION_HEX >= 0x02060000
327 #
if PY_VERSION_HEX >= 0x03040000
PyObject * TCustomInstanceMethod_New(PyObject *func, PyObject *self, PyObject *pyclass)
static PyObject * im_descr_get(PyObject *meth, PyObject *obj, PyObject *pyclass)
from instancemethod: don't rebind an already bound method, or an unbound method of a class that's not...
#define PyVarObject_HEAD_INIT(type, size)
PyTypeObject TCustomInt_Type
#define PyMethod_MAXFREELIST
static PyMethodObject * free_list
PyTypeObject TCustomInstanceMethod_Type
typedef void((*Func_t)())
PyTypeObject TCustomFloat_Type
Custom builtins, detectable by type, for pass by ref.
static PyObject * im_call(PyObject *meth, PyObject *args, PyObject *kw)
The mapping from a method to a function involves reshuffling of self back into the list of arguments...
static void im_dealloc(PyMethodObject *im)
from instancemethod, but with custom type (at issue is that instancemethod is not meant to be derived...