diff options
author | Tim Peters <tim.peters@gmail.com> | 2002-07-07 05:13:56 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2002-07-07 05:13:56 (GMT) |
commit | 803526b9e222077c5f9391d7e7348156eb7ba7da (patch) | |
tree | bd0cc321d21df84bc9e7b11457ef844d4ddf2e21 /Modules/gcmodule.c | |
parent | 943382c8e5009da895679798e1e740a0661fbf7e (diff) | |
download | cpython-803526b9e222077c5f9391d7e7348156eb7ba7da.zip cpython-803526b9e222077c5f9391d7e7348156eb7ba7da.tar.gz cpython-803526b9e222077c5f9391d7e7348156eb7ba7da.tar.bz2 |
Trashcan cleanup: Now that cyclic gc is always there, the trashcan
mechanism is no longer evil: it no longer plays dangerous games with
the type pointer or refcounts, and objects in extension modules can play
along too without needing to edit the core first.
Rewrote all the comments to explain this, and (I hope) give clear
guidance to extension authors who do want to play along. Documented
all the functions. Added more asserts (it may no longer be evil, but
it's still dangerous <0.9 wink>). Rearranged the generated code to
make it clearer, and to tolerate either the presence or absence of a
semicolon after the macros. Rewrote _PyTrash_destroy_chain() to call
tp_dealloc directly; it was doing a Py_DECREF again, and that has all
sorts of obscure distorting effects in non-release builds (Py_DECREF
was already called on the object!). Removed Christian's little "embedded
change log" comments -- that's what checkin messages are for, and since
it was impossible to correlate the comments with the code that changed,
I found them merely distracting.
Diffstat (limited to 'Modules/gcmodule.c')
-rw-r--r-- | Modules/gcmodule.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c index 5685101..e0c7631 100644 --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -963,6 +963,9 @@ _PyObject_GC_Track(PyObject *op) void PyObject_GC_UnTrack(void *op) { + /* Obscure: the Py_TRASHCAN mechanism requires that we be able to + * call PyObject_GC_UnTrack twice on an object. + */ if (IS_TRACKED(op)) _PyObject_GC_UNTRACK(op); } |