diff options
author | Benjamin Peterson <benjamin@python.org> | 2012-01-22 16:24:29 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2012-01-22 16:24:29 (GMT) |
commit | ce798520778e9cb41adfdc4f0a3cb5085a0b11be (patch) | |
tree | 915ea477cc6dfaa170d851f0c54f72b07c544874 /Objects/object.c | |
parent | cd8991255c963858cc74f32d718e1d54987b26a0 (diff) | |
download | cpython-ce798520778e9cb41adfdc4f0a3cb5085a0b11be.zip cpython-ce798520778e9cb41adfdc4f0a3cb5085a0b11be.tar.gz cpython-ce798520778e9cb41adfdc4f0a3cb5085a0b11be.tar.bz2 |
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.
Diffstat (limited to 'Objects/object.c')
-rw-r--r-- | Objects/object.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Objects/object.c b/Objects/object.c index 441068d..86f5e1b 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -470,7 +470,7 @@ PyObject * PyObject_Bytes(PyObject *v) { PyObject *result, *func; - static PyObject *bytesstring = NULL; + _Py_IDENTIFIER(__bytes__); if (v == NULL) return PyBytes_FromString("<NULL>"); @@ -480,7 +480,7 @@ PyObject_Bytes(PyObject *v) return v; } - func = _PyObject_LookupSpecial(v, "__bytes__", &bytesstring); + func = _PyObject_LookupSpecial(v, &PyId___bytes__); if (func != NULL) { result = PyObject_CallFunctionObjArgs(func, NULL); Py_DECREF(func); @@ -1298,8 +1298,8 @@ static PyObject * _dir_object(PyObject *obj) { PyObject *result, *sorted; - static PyObject *dir_str = NULL; - PyObject *dirfunc = _PyObject_LookupSpecial(obj, "__dir__", &dir_str); + _Py_IDENTIFIER(__dir__); + PyObject *dirfunc = _PyObject_LookupSpecial(obj, &PyId___dir__); assert(obj); if (dirfunc == NULL) { |