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.

Author eryksun
Recipients Anthony.LaTorre, eryksun
Date 2014-07-15.00:15:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1405383355.7.0.0460803758644.issue21983@psf.upfronthosting.co.za>
In-reply-to
Content
You need to cast to a pointer type, i.e. POINTER(Struct). Trying to cast to just Struct should raise a TypeError. Instead this revealed a bug in cast_check_pointertype (3.4.1):

http://hg.python.org/cpython/file/c0e311e010fc/Modules/_ctypes/_ctypes.c#l5225

dict->proto is NULL in the Struct type's stgdict, so PyUnicode_Check(dict->proto) segfaults. A simple fix is to add a check for this on line 5235:

    if (dict && dict->proto) {

Then cast will raise the expected TypeError from line 5242 on return from line 5255.
History
Date User Action Args
2014-07-15 00:15:56eryksunsetrecipients: + eryksun, Anthony.LaTorre
2014-07-15 00:15:55eryksunsetmessageid: <1405383355.7.0.0460803758644.issue21983@psf.upfronthosting.co.za>
2014-07-15 00:15:55eryksunlinkissue21983 messages
2014-07-15 00:15:53eryksuncreate