diff options
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/abstract.c | 4 | ||||
-rw-r--r-- | Objects/complexobject.c | 11 |
2 files changed, 8 insertions, 7 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c index 3410dd8..755cb0e 100644 --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2333,7 +2333,7 @@ abstract_get_bases(PyObject *cls) PyObject *bases; if (__bases__ == NULL) { - __bases__ = PyUnicode_FromString("__bases__"); + __bases__ = PyUnicode_InternFromString("__bases__"); if (__bases__ == NULL) return NULL; } @@ -2413,7 +2413,7 @@ recursive_isinstance(PyObject *inst, PyObject *cls, int recursion_depth) int retval = 0; if (__class__ == NULL) { - __class__ = PyUnicode_FromString("__class__"); + __class__ = PyUnicode_InternFromString("__class__"); if (__class__ == NULL) return -1; } diff --git a/Objects/complexobject.c b/Objects/complexobject.c index a7bf342..a08253e 100644 --- a/Objects/complexobject.c +++ b/Objects/complexobject.c @@ -265,13 +265,14 @@ PyComplex_AsCComplex(PyObject *op) /* return -1 on failure */ cv.real = -1.; cv.imag = 0.; - + + if (complex_str == NULL) { + if (!(complex_str = PyUnicode_FromString("__complex__"))) + return cv; + } + { PyObject *complexfunc; - if (!complex_str) { - if (!(complex_str = PyUnicode_FromString("__complex__"))) - return cv; - } complexfunc = _PyType_Lookup(op->ob_type, complex_str); /* complexfunc is a borrowed reference */ if (complexfunc) { |