diff Python/sysmodule.c @ 74578:7d96679c5d46

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.
author Benjamin Peterson <benjamin@python.org>
date Sun, 22 Jan 2012 11:24:29 -0500
parents 05e2bdc00c0c
children 8b591a86fc91
line wrap: on
line diff
--- a/Python/sysmodule.c	Sun Jan 22 12:16:04 2012 +0100
+++ b/Python/sysmodule.c	Sun Jan 22 11:24:29 2012 -0500
@@ -814,10 +814,11 @@
 sys_getsizeof(PyObject *self, PyObject *args, PyObject *kwds)
 {
     PyObject *res = NULL;
-    static PyObject *str__sizeof__ = NULL, *gc_head_size = NULL;
+    static PyObject *gc_head_size = NULL;
     static char *kwlist[] = {"object", "default", 0};
     PyObject *o, *dflt = NULL;
     PyObject *method;
+    _Py_IDENTIFIER(__sizeof__);
 
     if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|O:getsizeof",
                                      kwlist, &o, &dflt))
@@ -834,8 +835,7 @@
     if (PyType_Ready(Py_TYPE(o)) < 0)
         return NULL;
 
-    method = _PyObject_LookupSpecial(o, "__sizeof__",
-                                     &str__sizeof__);
+    method = _PyObject_LookupSpecial(o, &PyId___sizeof__);
     if (method == NULL) {
         if (!PyErr_Occurred())
             PyErr_Format(PyExc_TypeError,