diff options
Diffstat (limited to 'Objects/classobject.c')
| -rw-r--r-- | Objects/classobject.c | 23 | 
1 files changed, 16 insertions, 7 deletions
diff --git a/Objects/classobject.c b/Objects/classobject.c index f956852..cdc9b1c 100644 --- a/Objects/classobject.c +++ b/Objects/classobject.c @@ -14,6 +14,8 @@ static int numfree = 0;  #define PyMethod_MAXFREELIST 256  #endif +_Py_IDENTIFIER(__name__); +  PyObject *  PyMethod_Function(PyObject *im)  { @@ -190,8 +192,7 @@ method_richcompare(PyObject *self, PyObject *other, int op)          !PyMethod_Check(self) ||          !PyMethod_Check(other))      { -        Py_INCREF(Py_NotImplemented); -        return Py_NotImplemented; +        Py_RETURN_NOTIMPLEMENTED;      }      a = (PyMethodObject *)self;      b = (PyMethodObject *)other; @@ -228,7 +229,7 @@ method_repr(PyMethodObject *a)      }      klass = (PyObject*)Py_TYPE(self); -    funcname = PyObject_GetAttrString(func, "__name__"); +    funcname = _PyObject_GetAttrId(func, &PyId___name__);      if (funcname == NULL) {          if (!PyErr_ExceptionMatches(PyExc_AttributeError))              return NULL; @@ -242,7 +243,7 @@ method_repr(PyMethodObject *a)      if (klass == NULL)          klassname = NULL;      else { -        klassname = PyObject_GetAttrString(klass, "__name__"); +        klassname = _PyObject_GetAttrId(klass, &PyId___name__);          if (klassname == NULL) {              if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {                  Py_XDECREF(funcname); @@ -402,6 +403,15 @@ PyMethod_Fini(void)      (void)PyMethod_ClearFreeList();  } +/* Print summary info about the state of the optimized allocator */ +void +_PyMethod_DebugMallocStats(FILE *out) +{ +    _PyDebugAllocatorStats(out, +                           "free PyMethodObject", +                           numfree, sizeof(PyMethodObject)); +} +  /* ------------------------------------------------------------------------   * instance method   */ @@ -519,8 +529,7 @@ instancemethod_richcompare(PyObject *self, PyObject *other, int op)          !PyInstanceMethod_Check(self) ||          !PyInstanceMethod_Check(other))      { -        Py_INCREF(Py_NotImplemented); -        return Py_NotImplemented; +        Py_RETURN_NOTIMPLEMENTED;      }      a = (PyInstanceMethodObject *)self;      b = (PyInstanceMethodObject *)other; @@ -547,7 +556,7 @@ instancemethod_repr(PyObject *self)          return NULL;      } -    funcname = PyObject_GetAttrString(func, "__name__"); +    funcname = _PyObject_GetAttrId(func, &PyId___name__);      if (funcname == NULL) {          if (!PyErr_ExceptionMatches(PyExc_AttributeError))              return NULL;  | 
