Mercurial > cpython-lru_cache-weakref
diff Objects/typeobject.c @ 41112:d4ea068c3820 2.5
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)
| author | Žiga Seilnacht <ziga.seilnacht@gmail.com> |
|---|---|
| date | Sun, 11 Mar 2007 16:01:51 +0000 |
| parents | 83efff4d5ae9 |
| children | fc5e045ceae4 |
line wrap: on
line diff
--- a/Objects/typeobject.c Sun Mar 11 08:28:50 2007 +0000 +++ b/Objects/typeobject.c Sun Mar 11 16:01:51 2007 +0000 @@ -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 *); } }
