Allow tp_len slot to support overloaded methods
This commit is contained in:
1 parent
defacaade6
commit
18e2fa57d2
2 files changed
+32
-5
No files matched your search
@@ -244,6 +244,28 @@ static Py_ssize_t
|
||||
return result;
|
||||
}
|
||||
|
||||
''',
|
||||
|
||||
# This hacky version is necessary 'cause if we're calling a function rather than a method
|
||||
# or an overloaded wrapper the args parameter gets tacked into the call sequence.
|
||||
"sq_length_ARGS" : '''
|
||||
static Py_ssize_t
|
||||
%(wrapper_name)s (%(py_struct)s *py_self)
|
||||
{
|
||||
PyObject *py_result;
|
||||
PyObject *args;
|
||||
|
||||
Py_ssize_t result;
|
||||
|
||||
py_result = %(method_name)s(py_self, args, NULL);
|
||||
if (py_result == NULL) {
|
||||
return -1;
|
||||
}
|
||||
result = PyInt_AsSsize_t(py_result);
|
||||
Py_DECREF(py_result);
|
||||
return result;
|
||||
}
|
||||
|
||||
''',
|
||||
|
||||
"sq_item" : '''
|
||||
|
||||
Reference in new issue
Block a user