Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ba40ec4

Browse files
committed
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.
1 parent 9b03e59 commit ba40ec4

1 file changed

Lines changed: 0 additions & 4 deletions

File tree

Objects/object.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,6 @@ PyObject_Init(PyObject *op, PyTypeObject *tp)
100100
/* Any changes should be reflected in PyObject_INIT (objimpl.h) */
101101
op->ob_type = tp;
102102
_Py_NewReference(op);
103-
if (PyType_SUPPORTS_WEAKREFS(tp)) {
104-
PyObject **weaklist = PyObject_GET_WEAKREFS_LISTPTR(op);
105-
*weaklist = NULL;
106-
}
107103
return op;
108104
}
109105

0 commit comments

Comments
 (0)