[Python-checkins] r54272 - in python/branches/release25-maint: Misc/NEWS Objects/typeobject.c
ziga.seilnacht
python-checkins at python.org
Sun Mar 11 17:01:54 CET 2007
Author: ziga.seilnacht
Date: Sun Mar 11 17:01:51 2007
New Revision: 54272
Modified:
python/branches/release25-maint/Misc/NEWS
python/branches/release25-maint/Objects/typeobject.c
Log:
Patch #1675981: remove unreachable code from type.__new__() method.
__dict__ and __weakref__ are removed from the slots tuple earlier
in the code, in the loop that mangles slot names.
(backport from rev. 54270)
Modified: python/branches/release25-maint/Misc/NEWS
==============================================================================
--- python/branches/release25-maint/Misc/NEWS (original)
+++ python/branches/release25-maint/Misc/NEWS Sun Mar 11 17:01:51 2007
@@ -12,6 +12,8 @@
Core and builtins
-----------------
+- Patch #1675981: remove unreachable code from ``type.__new__()`` method.
+
- Patch #1638879: don't accept strings with embedded NUL bytes in long().
- Bug #1674503: close the file opened by execfile() in an error condition.
Modified: python/branches/release25-maint/Objects/typeobject.c
==============================================================================
--- python/branches/release25-maint/Objects/typeobject.c (original)
+++ python/branches/release25-maint/Objects/typeobject.c Sun Mar 11 17:01:51 2007
@@ -1935,13 +1935,11 @@
PyTuple_GET_ITEM(slots, i));
mp->type = T_OBJECT_EX;
mp->offset = slotoffset;
- if (base->tp_weaklistoffset == 0 &&
- strcmp(mp->name, "__weakref__") == 0) {
- add_weak++;
- mp->type = T_OBJECT;
- mp->flags = READONLY;
- type->tp_weaklistoffset = slotoffset;
- }
+
+ /* __dict__ and __weakref__ are already filtered out */
+ assert(strcmp(mp->name, "__dict__") != 0);
+ assert(strcmp(mp->name, "__weakref__") != 0);
+
slotoffset += sizeof(PyObject *);
}
}
More information about the Python-checkins
mailing list