[Patches] [ python-Patches-1011240 ] SystemError generated by struct.pack('P', 'notanumber')

SourceForge.net noreply at sourceforge.net
Wed Aug 18 08:53:33 CEST 2004


Patches item #1011240, was opened at 2004-08-18 06:53
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1011240&group_id=5470

Category: Modules
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Dima Dorfman (ddorfman)
Assigned to: Nobody/Anonymous (nobody)
Summary: SystemError generated by struct.pack('P', 'notanumber')

Initial Comment:
Trying to use the struct module's 'P' format with a
non-numeric arguments yields a SystemError. When the P
format was implemented in rev 2.28, the get_pylong helper
wasn't available, so it was less obvious how do this
right. Now that the helper is available, it's straight-
forward to use it to ensure proper error reporting instead
of rolling our own. Interestingly, the comment in np_void_p
indicates that the author knew about this problem; my guess
is that they intended to fix it by changing PyLong_AsVoidPtr
to generate TypeError instead, but SystemError is the right
thing to do because it's consistent with the rest of the C
API, and get_pylong deals with this properly.

References: structmodule.c 2.28 and 2.47

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1011240&group_id=5470


More information about the Patches mailing list