summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2001-10-03 00:50:18 (GMT)
committerGuido van Rossum <guido@python.org>2001-10-03 00:50:18 (GMT)
commitda21c0110b1948d4b3e0593e06436a2a5582f366 (patch)
tree1a95b0f40e59db48b855d86443d18ca60244b9b0 /Objects
parented554f6fc70416a726cd4abc44268dea4bf031e4 (diff)
downloadcpython-da21c0110b1948d4b3e0593e06436a2a5582f366.zip
cpython-da21c0110b1948d4b3e0593e06436a2a5582f366.tar.gz
cpython-da21c0110b1948d4b3e0593e06436a2a5582f366.tar.bz2
call_method(), call_maybe(): fix a performance bug: the argument
pointing to a static variable to hold the object form of the string was never used, causing endless calls to PyString_InternFromString(). One particular test (with lots of __getitem__ calls) became a third faster with this!
Diffstat (limited to 'Objects')
-rw-r--r--Objects/typeobject.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 295be89..a681d33 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -378,18 +378,15 @@ call_method(PyObject *o, char *name, PyObject **nameobj, char *format, ...)
{
va_list va;
PyObject *args, *func = 0, *retval;
- PyObject *dummy_str = NULL;
va_start(va, format);
- func = lookup_maybe(o, name, &dummy_str);
+ func = lookup_maybe(o, name, nameobj);
if (func == NULL) {
va_end(va);
if (!PyErr_Occurred())
- PyErr_SetObject(PyExc_AttributeError, dummy_str);
- Py_XDECREF(dummy_str);
+ PyErr_SetObject(PyExc_AttributeError, *nameobj);
return NULL;
}
- Py_DECREF(dummy_str);
if (format && *format)
args = Py_VaBuildValue(format, va);
@@ -417,11 +414,9 @@ call_maybe(PyObject *o, char *name, PyObject **nameobj, char *format, ...)
{
va_list va;
PyObject *args, *func = 0, *retval;
- PyObject *dummy_str = NULL;
va_start(va, format);
- func = lookup_maybe(o, name, &dummy_str);
- Py_XDECREF(dummy_str);
+ func = lookup_maybe(o, name, nameobj);
if (func == NULL) {
va_end(va);
if (!PyErr_Occurred()) {