summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-05-29 14:35:39 (GMT)
committerGeorg Brandl <georg@python.org>2008-05-29 14:35:39 (GMT)
commitf18a70720542268586e271bbadab3fb0332b8a39 (patch)
tree8d84ada7c929701bdc5f95d4914cba39450150e7
parent2a9179ac73fe0adbce84b55a93e7f966bd8c34cd (diff)
downloadcpython-f18a70720542268586e271bbadab3fb0332b8a39.zip
cpython-f18a70720542268586e271bbadab3fb0332b8a39.tar.gz
cpython-f18a70720542268586e271bbadab3fb0332b8a39.tar.bz2
Revert #2990 patch; it's not necessary as Armin showed.
-rw-r--r--Objects/typeobject.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 70fd1f2..151ea69 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -147,7 +147,7 @@ assign_version_tag(PyTypeObject *type)
cannot be done, 1 if Py_TPFLAGS_VALID_VERSION_TAG.
*/
Py_ssize_t i, n;
- PyObject *bases, *tmp;
+ PyObject *bases;
if (PyType_HasFeature(type, Py_TPFLAGS_VALID_VERSION_TAG))
return 1;
@@ -166,10 +166,9 @@ assign_version_tag(PyTypeObject *type)
are borrowed reference */
for (i = 0; i < (1 << MCACHE_SIZE_EXP); i++) {
method_cache[i].value = NULL;
- tmp = method_cache[i].name;
- Py_INCREF(Py_None);
+ Py_XDECREF(method_cache[i].name);
method_cache[i].name = Py_None;
- Py_XDECREF(tmp);
+ Py_INCREF(Py_None);
}
/* mark all version tags as invalid */
PyType_Modified(&PyBaseObject_Type);
@@ -2414,7 +2413,7 @@ PyObject *
_PyType_Lookup(PyTypeObject *type, PyObject *name)
{
Py_ssize_t i, n;
- PyObject *mro, *res, *base, *dict, *tmp;
+ PyObject *mro, *res, *base, *dict;
unsigned int h;
if (MCACHE_CACHEABLE_NAME(name) &&
@@ -2456,10 +2455,9 @@ _PyType_Lookup(PyTypeObject *type, PyObject *name)
h = MCACHE_HASH_METHOD(type, name);
method_cache[h].version = type->tp_version_tag;
method_cache[h].value = res; /* borrowed */
- tmp = method_cache[h].name;
Py_INCREF(name);
+ Py_DECREF(method_cache[h].name);
method_cache[h].name = name;
- Py_DECREF(tmp);
}
return res;
}