mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
use the static identifier api for looking up special methods
I had to move the static identifier code from unicodeobject.h to object.h in order for this to work.
This commit is contained in:
parent
cd8991255c
commit
ce79852077
11 changed files with 153 additions and 164 deletions
|
|
@ -265,9 +265,9 @@ PyComplex_ImagAsDouble(PyObject *op)
|
|||
static PyObject *
|
||||
try_complex_special_method(PyObject *op) {
|
||||
PyObject *f;
|
||||
static PyObject *complexstr;
|
||||
_Py_IDENTIFIER(__complex__);
|
||||
|
||||
f = _PyObject_LookupSpecial(op, "__complex__", &complexstr);
|
||||
f = _PyObject_LookupSpecial(op, &PyId___complex__);
|
||||
if (f) {
|
||||
PyObject *res = PyObject_CallFunctionObjArgs(f, NULL);
|
||||
Py_DECREF(f);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue