mirror of
https://github.com/python/cpython.git
synced 2025-12-04 16:43:27 +00:00
#4930: Slightly cleaner (and faster) code in type creation:
compare slots by address, not by name.
This commit is contained in:
parent
d25f87ae36
commit
bd55c52565
1 changed files with 2 additions and 2 deletions
|
|
@ -6114,7 +6114,7 @@ update_one_slot(PyTypeObject *type, slotdef *p)
|
||||||
else if (Py_TYPE(descr) == &PyCFunction_Type &&
|
else if (Py_TYPE(descr) == &PyCFunction_Type &&
|
||||||
PyCFunction_GET_FUNCTION(descr) ==
|
PyCFunction_GET_FUNCTION(descr) ==
|
||||||
(PyCFunction)tp_new_wrapper &&
|
(PyCFunction)tp_new_wrapper &&
|
||||||
strcmp(p->name, "__new__") == 0)
|
ptr == (void**)&type->tp_new)
|
||||||
{
|
{
|
||||||
/* The __new__ wrapper is not a wrapper descriptor,
|
/* The __new__ wrapper is not a wrapper descriptor,
|
||||||
so must be special-cased differently.
|
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. */
|
point out a bug in this reasoning a beer. */
|
||||||
}
|
}
|
||||||
else if (descr == Py_None &&
|
else if (descr == Py_None &&
|
||||||
strcmp(p->name, "__hash__") == 0) {
|
ptr == (void**)&type->tp_hash) {
|
||||||
/* We specifically allow __hash__ to be set to None
|
/* We specifically allow __hash__ to be set to None
|
||||||
to prevent inheritance of the default
|
to prevent inheritance of the default
|
||||||
implementation from object.__hash__ */
|
implementation from object.__hash__ */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue