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. Will backport.
This commit is contained in:
parent
b27831887f
commit
8903208776
|
@ -12,6 +12,8 @@ What's New in Python 2.6 alpha 1?
|
||||||
Core and builtins
|
Core and builtins
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- Patch #1675981: remove unreachable code from ``type.__new__()`` method.
|
||||||
|
|
||||||
- Patch #1491866: change the complex() constructor to allow parthensized
|
- Patch #1491866: change the complex() constructor to allow parthensized
|
||||||
forms. This means complex(repr(x)) now works instead of raising a
|
forms. This means complex(repr(x)) now works instead of raising a
|
||||||
ValueError.
|
ValueError.
|
||||||
|
|
|
@ -1997,13 +1997,11 @@ type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
|
||||||
PyTuple_GET_ITEM(slots, i));
|
PyTuple_GET_ITEM(slots, i));
|
||||||
mp->type = T_OBJECT_EX;
|
mp->type = T_OBJECT_EX;
|
||||||
mp->offset = slotoffset;
|
mp->offset = slotoffset;
|
||||||
if (base->tp_weaklistoffset == 0 &&
|
|
||||||
strcmp(mp->name, "__weakref__") == 0) {
|
/* __dict__ and __weakref__ are already filtered out */
|
||||||
add_weak++;
|
assert(strcmp(mp->name, "__dict__") != 0);
|
||||||
mp->type = T_OBJECT;
|
assert(strcmp(mp->name, "__weakref__") != 0);
|
||||||
mp->flags = READONLY;
|
|
||||||
type->tp_weaklistoffset = slotoffset;
|
|
||||||
}
|
|
||||||
slotoffset += sizeof(PyObject *);
|
slotoffset += sizeof(PyObject *);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue