summaryrefslogtreecommitdiffstats
path: root/Objects/codeobject.c
diff options
context:
space:
mode:
authorCollin Winter <collinw@gmail.com>2010-03-18 22:46:40 (GMT)
committerCollin Winter <collinw@gmail.com>2010-03-18 22:46:40 (GMT)
commit4222e9c07cc9a223ac756f8cc1c1cd2f9212765e (patch)
treed9d477df9e477ed208bee9b3748f7ad1492e8f86 /Objects/codeobject.c
parentb3a482962d12871db122dbc843476eea054b2782 (diff)
downloadcpython-4222e9c07cc9a223ac756f8cc1c1cd2f9212765e.zip
cpython-4222e9c07cc9a223ac756f8cc1c1cd2f9212765e.tar.gz
cpython-4222e9c07cc9a223ac756f8cc1c1cd2f9212765e.tar.bz2
Merged revisions 79060 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r79060 | collin.winter | 2010-03-18 14:54:01 -0700 (Thu, 18 Mar 2010) | 4 lines Add support for weak references to code objects. This will be used by an optimization in the incoming Python 3 JIT. Patch by Reid Kleckner! ........
Diffstat (limited to 'Objects/codeobject.c')
-rw-r--r--Objects/codeobject.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Objects/codeobject.c b/Objects/codeobject.c
index a772c56..3e71e4c 100644
--- a/Objects/codeobject.c
+++ b/Objects/codeobject.c
@@ -108,6 +108,7 @@ PyCode_New(int argcount, int kwonlyargcount,
Py_INCREF(lnotab);
co->co_lnotab = lnotab;
co->co_zombieframe = NULL;
+ co->co_weakreflist = NULL;
}
return co;
}
@@ -331,6 +332,8 @@ code_dealloc(PyCodeObject *co)
Py_XDECREF(co->co_lnotab);
if (co->co_zombieframe != NULL)
PyObject_GC_Del(co->co_zombieframe);
+ if (co->co_weakreflist != NULL)
+ PyObject_ClearWeakRefs((PyObject*)co);
PyObject_DEL(co);
}
@@ -462,7 +465,7 @@ PyTypeObject PyCode_Type = {
0, /* tp_traverse */
0, /* tp_clear */
code_richcompare, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
+ offsetof(PyCodeObject, co_weakreflist), /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
0, /* tp_methods */