summaryrefslogtreecommitdiffstats
path: root/Objects/classobject.c
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2001-03-22 18:26:47 (GMT)
committerFred Drake <fdrake@acm.org>2001-03-22 18:26:47 (GMT)
commit4e262a963190b201578b0b5d972035b1637f6bd5 (patch)
tree8c1e035b25075b1fb03f71d101260984d58a0e7c /Objects/classobject.c
parent82f1480d63a43c2007460e8f186aba8d0fc4ce38 (diff)
downloadcpython-4e262a963190b201578b0b5d972035b1637f6bd5.zip
cpython-4e262a963190b201578b0b5d972035b1637f6bd5.tar.gz
cpython-4e262a963190b201578b0b5d972035b1637f6bd5.tar.bz2
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).
Diffstat (limited to 'Objects/classobject.c')
-rw-r--r--Objects/classobject.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/Objects/classobject.c b/Objects/classobject.c
index 00cfdde..d7b4c1e 100644
--- a/Objects/classobject.c
+++ b/Objects/classobject.c
@@ -453,6 +453,7 @@ PyInstance_NewRaw(PyObject *klass, PyObject *dict)
Py_DECREF(dict);
return NULL;
}
+ inst->in_weakreflist = NULL;
Py_INCREF(klass);
inst->in_class = (PyClassObject *)klass;
inst->in_dict = dict;