diff Include/objimpl.h @ 17154:3b8a5bbfd2e5 legacy-trunk

A small change to the C API for weakly-referencable types: Such types must now initialize the extra field used by the weak-ref machinery to NULL themselves, to avoid having to require PyObject_INIT() to check if the type supports weak references and do it there. This causes less work to be done for all objects (the type object does not need to be consulted to check for the Py_TPFLAGS_HAVE_WEAKREFS bit).
author Fred Drake <fdrake@acm.org>
date Thu, 22 Mar 2001 18:26:47 +0000
parents 5864a9c58c81
children 09df3254b49d
line wrap: on
line diff
--- a/Include/objimpl.h	Thu Mar 22 18:05:30 2001 +0000
+++ b/Include/objimpl.h	Thu Mar 22 18:26:47 2001 +0000
@@ -167,11 +167,7 @@
 /* Macros trading binary compatibility for speed. See also pymem.h.
    Note that these macros expect non-NULL object pointers.*/
 #define PyObject_INIT(op, typeobj) \
-	((op)->ob_type = (typeobj), _Py_NewReference((PyObject *)(op)), \
-	 (PyType_SUPPORTS_WEAKREFS((typeobj)) \
-	      ? *(PyObject_GET_WEAKREFS_LISTPTR(op)) = NULL \
-              : NULL), \
-         (op))
+	( (op)->ob_type = (typeobj), _Py_NewReference((PyObject *)(op)), (op) )
 #define PyObject_INIT_VAR(op, typeobj, size) \
 	( (op)->ob_size = (size), PyObject_INIT((op), (typeobj)) )