mirror of
https://github.com/python/cpython.git
synced 2024-12-01 11:15:56 +01:00
Remove unnecessary intialization for the case of weakly-referencable objects;
the code necessary to accomplish this is simpler and faster if confined to the object implementations, so we only do this there. This causes no behaviorial changes beyond a (very slight) speedup.
This commit is contained in:
parent
9b03e59deb
commit
ba40ec42c8
@ -100,10 +100,6 @@ PyObject_Init(PyObject *op, PyTypeObject *tp)
|
||||
/* Any changes should be reflected in PyObject_INIT (objimpl.h) */
|
||||
op->ob_type = tp;
|
||||
_Py_NewReference(op);
|
||||
if (PyType_SUPPORTS_WEAKREFS(tp)) {
|
||||
PyObject **weaklist = PyObject_GET_WEAKREFS_LISTPTR(op);
|
||||
*weaklist = NULL;
|
||||
}
|
||||
return op;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user