[Python-checkins] r68665 - python/trunk/Objects/typeobject.c
amaury.forgeotdarc
python-checkins at python.org
Sat Jan 17 18:11:51 CET 2009
Author: amaury.forgeotdarc
Date: Sat Jan 17 18:11:50 2009
New Revision: 68665
Log:
#4930: Slightly cleaner (and faster) code in type creation:
compare slots by address, not by name.
Modified:
python/trunk/Objects/typeobject.c
Modified: python/trunk/Objects/typeobject.c
==============================================================================
--- python/trunk/Objects/typeobject.c (original)
+++ python/trunk/Objects/typeobject.c Sat Jan 17 18:11:50 2009
@@ -6114,7 +6114,7 @@
else if (Py_TYPE(descr) == &PyCFunction_Type &&
PyCFunction_GET_FUNCTION(descr) ==
(PyCFunction)tp_new_wrapper &&
- strcmp(p->name, "__new__") == 0)
+ ptr == (void**)&type->tp_new)
{
/* The __new__ wrapper is not a wrapper descriptor,
so must be special-cased differently.
@@ -6134,7 +6134,7 @@
point out a bug in this reasoning a beer. */
}
else if (descr == Py_None &&
- strcmp(p->name, "__hash__") == 0) {
+ ptr == (void**)&type->tp_hash) {
/* We specifically allow __hash__ to be set to None
to prevent inheritance of the default
implementation from object.__hash__ */
More information about the Python-checkins
mailing list