summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2012-01-22 16:24:29 (GMT)
committerBenjamin Peterson <benjamin@python.org>2012-01-22 16:24:29 (GMT)
commitce798520778e9cb41adfdc4f0a3cb5085a0b11be (patch)
tree915ea477cc6dfaa170d851f0c54f72b07c544874 /Modules
parentcd8991255c963858cc74f32d718e1d54987b26a0 (diff)
downloadcpython-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 'Modules')
-rw-r--r--Modules/mathmodule.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c
index c4cc46e..04f8f66 100644
--- a/Modules/mathmodule.c
+++ b/Modules/mathmodule.c
@@ -887,10 +887,10 @@ FUNC1(atanh, m_atanh, 0,
"atanh(x)\n\nReturn the hyperbolic arc tangent (measured in radians) of x.")
static PyObject * math_ceil(PyObject *self, PyObject *number) {
- static PyObject *ceil_str = NULL;
+ _Py_IDENTIFIER(__ceil__);
PyObject *method, *result;
- method = _PyObject_LookupSpecial(number, "__ceil__", &ceil_str);
+ method = _PyObject_LookupSpecial(number, &PyId___ceil__);
if (method == NULL) {
if (PyErr_Occurred())
return NULL;
@@ -925,10 +925,10 @@ FUNC1(fabs, fabs, 0,
"fabs(x)\n\nReturn the absolute value of the float x.")
static PyObject * math_floor(PyObject *self, PyObject *number) {
- static PyObject *floor_str = NULL;
+ _Py_IDENTIFIER(__floor__);
PyObject *method, *result;
- method = _PyObject_LookupSpecial(number, "__floor__", &floor_str);
+ method = _PyObject_LookupSpecial(number, &PyId___floor__);
if (method == NULL) {
if (PyErr_Occurred())
return NULL;
@@ -1462,7 +1462,7 @@ PyDoc_STRVAR(math_factorial_doc,
static PyObject *
math_trunc(PyObject *self, PyObject *number)
{
- static PyObject *trunc_str = NULL;
+ _Py_IDENTIFIER(__trunc__);
PyObject *trunc, *result;
if (Py_TYPE(number)->tp_dict == NULL) {
@@ -1470,7 +1470,7 @@ math_trunc(PyObject *self, PyObject *number)
return NULL;
}
- trunc = _PyObject_LookupSpecial(number, "__trunc__", &trunc_str);
+ trunc = _PyObject_LookupSpecial(number, &PyId___trunc__);
if (trunc == NULL) {
if (!PyErr_Occurred())
PyErr_Format(PyExc_TypeError,