[issue7689] Pickling of classes with a metaclass and copy_reg
Changes by Bryan Silverthorn : -- nosy: +bsilverthorn ___ Python tracker <http://bugs.python.org/issue7689> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1662] [patch] assert tp_traverse in PyType_GenericAlloc()
New submission from Bryan Silverthorn: Attached is a very short patch against r59568 which asserts tp_traverse on (the types of) objects allocated in PyType_GenericAlloc(). As far as I'm aware, tp_traverse should always be set at this point. Catching that error early, even if only in debug builds, would help to prevent bugs like http://bugzilla.gnome.org/show_bug.cgi?id=504337 . -- components: Interpreter Core files: bcs_typeobject_assert.patch messages: 58811 nosy: bsilverthorn severity: minor status: open title: [patch] assert tp_traverse in PyType_GenericAlloc() type: behavior versions: Python 2.6 Added file: http://bugs.python.org/file8998/bcs_typeobject_assert.patch __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1662> __Index: Objects/typeobject.c === --- Objects/typeobject.c (revision 59568) +++ Objects/typeobject.c (working copy) @@ -469,8 +469,10 @@ else (void) PyObject_INIT_VAR((PyVarObject *)obj, type, nitems); - if (PyType_IS_GC(type)) + if (PyType_IS_GC(type)) { + assert(type->tp_traverse); _PyObject_GC_TRACK(obj); + } return obj; } ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1662] [patch] assert tp_traverse in PyType_GenericAlloc()
Bryan Silverthorn added the comment: I submitted this patch 14 years ago and am sure of nothing. :) -- ___ Python tracker <https://bugs.python.org/issue1662> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1662] [patch] assert tp_traverse in PyType_GenericAlloc()
Bryan Silverthorn added the comment: Well, there's no Python bug per se, hence no test case; this patch just adds a single additional assert that might catch a particular extension implementation mistake. It was prompted by tracking down the bug in pygtk mentioned above. I've attached an updated patch against r72055. It's a trivial change, but I would suggest that someone more familiar with the Python core sign off on it regardless. -- Added file: http://bugs.python.org/file13800/bcs_assert_tp_traverse_r72055.patch ___ Python tracker <http://bugs.python.org/issue1662> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1662] [patch] assert tp_traverse in PyType_GenericAlloc()
Changes by Bryan Silverthorn : Removed file: http://bugs.python.org/file8998/bcs_typeobject_assert.patch ___ Python tracker <http://bugs.python.org/issue1662> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com