Title: _ctypes.COMError crash
Type: crash Stage:
Components: ctypes Versions: Python 3.0
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: theller Nosy List: benjamin.peterson, theller
Priority: release blocker Keywords: patch

Created on 2008-11-26 08:36 by theller, last changed 2008-11-26 18:55 by theller. This issue is now closed.

File name Uploaded Description Edit
ctypes.patch theller, 2008-11-26 08:36
Messages (3)
msg76451 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2008-11-26 08:36
The following code, which only works on Windows, crashes with an access
violation somewhere in the garbage collector in a debug build:

>>> import _ctypes
[43470 refs]
>>> _ctypes.COMError(1, 2, 3)

The problem is that the PyComError_Type's tp_flags contains
Py_TPFLAGS_HAVE_GC although the tp_traverse slot is NULL.

The attached patch removes the Py_TPFLAGS_HAVE_GC which is not necessary
at all because a PyComError_Type instance (normally) only contains
simple objects (strings, numbers, None, and a tuple of strings, numbers,
and None), so no reference cycles should be possible.
msg76470 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-11-26 15:47
Ok. Looks good.
msg76481 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2008-11-26 18:55
Thanks for the review; committed as svn rev. 67402.
Date User Action Args
2008-11-26 18:55:16thellersetstatus: open -> closed
resolution: fixed
messages: + msg76481
keywords: patch, patch
2008-11-26 15:47:30benjamin.petersonsetkeywords: - needs review
nosy: + benjamin.peterson
messages: + msg76470
2008-11-26 08:36:06thellercreate