summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2009-01-17 17:11:50 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2009-01-17 17:11:50 (GMT)
commitbd55c52565d171ceb78d8f3b0f8b6cc6253e8e68 (patch)
treeb3c154508ae7d4958972d891b7432765702b9394
parentd25f87ae366f205a88ed925e826367c952eadfd1 (diff)
downloadcpython-bd55c52565d171ceb78d8f3b0f8b6cc6253e8e68.zip
cpython-bd55c52565d171ceb78d8f3b0f8b6cc6253e8e68.tar.gz
cpython-bd55c52565d171ceb78d8f3b0f8b6cc6253e8e68.tar.bz2
#4930: Slightly cleaner (and faster) code in type creation:
compare slots by address, not by name.
-rw-r--r--Objects/typeobject.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 8242242..5e9073d 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -6114,7 +6114,7 @@ update_one_slot(PyTypeObject *type, slotdef *p)
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 @@ update_one_slot(PyTypeObject *type, slotdef *p)
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__ */