This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: ctypes assertion failure in trunk
Type: crash Stage:
Components: ctypes Versions: Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: theller Nosy List: kevinwatters, theller, tim.golden
Priority: normal Keywords:

Created on 2008-07-02 16:28 by tim.golden, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg69102 - (view) Author: Tim Golden (tim.golden) * (Python committer) Date: 2008-07-02 16:28
The following code raises an Assertion Failure under debug in r64518
running on Windows XP SP2:

<code>
import ctypes

class X (ctypes.Structure): pass

ctypes.POINTER (X)
</code>

Assertion failed: PyErr_Occurred(), file ..\Modules\_ctypes\_ctypes.c,
line 309
msg69103 - (view) Author: Tim Golden (tim.golden) * (Python committer) Date: 2008-07-02 16:29
The comment just before _ctypes.c:309 indicates that when a NULL is
returned at that point, an error condition should already obtain.
msg69451 - (view) Author: Kevin Watters (kevinwatters) Date: 2008-07-09 02:30
From reading through PEP 3118 once I'm not entirely clear on the role 
stgdict->format is supposed to be taking here, but I did get comtypes to 
compile and run successfully by changing line 910 from

stgdict->format = alloc_format_string("&", itemdict->format);

to

stgdict->format = alloc_format_string("&", itemdict->format ? itemdict-
>format : "P");

(Where "P" is just struct.pack's void pointer format string.)
msg69697 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2008-07-15 17:27
Thanks for the heads up.  Fixed in trunk (rev 64971) and py3k (rev 64972).

I used "&B" (pointer to bytes) as the format string for pointer to
incomplete structure, not "&P".
History
Date User Action Args
2022-04-11 14:56:36adminsetgithub: 47508
2008-07-15 17:27:49thellersetstatus: open -> closed
resolution: fixed
messages: + msg69697
2008-07-09 02:30:48kevinwatterssetmessages: + msg69451
2008-07-03 13:32:30kevinwatterssetnosy: + kevinwatters
2008-07-02 16:29:25tim.goldensetmessages: + msg69103
2008-07-02 16:28:04tim.goldencreate