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