classification
Title: [patch] assert tp_traverse in PyType_GenericAlloc()
Type: behavior Stage: test needed
Components: Interpreter Core Versions: Python 3.2, Python 3.3, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: ajaksu2, bsilverthorn, pitrou
Priority: normal Keywords: patch

Created on 2007-12-19 17:22 by bsilverthorn, last changed 2011-06-26 19:56 by terry.reedy.

Files
File name Uploaded Description Edit
bcs_assert_tp_traverse_r72055.patch bsilverthorn, 2009-04-28 01:24
Messages (4)
msg58811 - (view) Author: Bryan Silverthorn (bsilverthorn) Date: 2007-12-19 17:22
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 .
msg86708 - (view) Author: Daniel Diniz (ajaksu2) Date: 2009-04-27 22:57
Bryan: can you provide a test case without external dependencies? If
not, confirming this is still valid in 2.6 would also help.
msg86712 - (view) Author: Bryan Silverthorn (bsilverthorn) Date: 2009-04-28 01:24
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.
msg86899 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-05-01 20:03
It would be probably be better to put this check in PyType_Ready() instead.
History
Date User Action Args
2011-06-26 19:56:47terry.reedysetversions: + Python 3.2, Python 3.3, - Python 3.1
2009-05-01 20:03:52pitrousetnosy: + pitrou

messages: + msg86899
versions: + Python 3.1, Python 2.7, - Python 2.6
2009-04-28 01:24:43bsilverthornsetfiles: - bcs_typeobject_assert.patch
2009-04-28 01:24:35bsilverthornsetfiles: + bcs_assert_tp_traverse_r72055.patch

messages: + msg86712
2009-04-27 22:57:28ajaksu2setnosy: + ajaksu2

messages: + msg86708
stage: test needed
2007-12-19 17:45:59christian.heimessetpriority: normal
keywords: + patch
2007-12-19 17:22:01bsilverthorncreate