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 jvr
Recipients jvr
Date 2008-03-10.07:39:22
SpamBayes Score 0.047963195
Marked as misclassified No
Message-id <1205134764.8.0.415620235375.issue2263@psf.upfronthosting.co.za>
In-reply-to
Content
struct.pack() raises SystemError when fed a numpy integer in some cases. 
The following was run on MacOSX 10.4, little endian (I can only 
reproduce the error if I specify big endian for the struct format). Not 
sure if this could be a numpy bug.

Python 2.5.2 (r252:60911, Feb 22 2008, 07:57:53) 
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import struct
>>> import numpy
>>> i = numpy.int16(1)
>>> struct.pack(">B", i)
__main__:1: DeprecationWarning: struct integer overflow masking is 
deprecated
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File 
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/struct.
py", line 63, in pack
    return o.pack(*args)
SystemError: /Users/ronald/r252/Objects/longobject.c:322: bad argument 
to internal function
>>> struct.pack(">H", i)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File 
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/struct.
py", line 63, in pack
    return o.pack(*args)
SystemError: /Users/ronald/r252/Objects/longobject.c:322: bad argument 
to internal function
>>> struct.pack(">h", i)
'\x00\x01'
>>> struct.pack(">b", i)
'\x01'
>>> struct.pack("B", i)
'\x01'
>>> struct.pack("h", i)
'\x01\x00'
>>> numpy.__version__
'1.0.4'
>>>
History
Date User Action Args
2008-03-10 07:39:25jvrsetspambayes_score: 0.0479632 -> 0.047963195
recipients: + jvr
2008-03-10 07:39:24jvrsetspambayes_score: 0.0479632 -> 0.0479632
messageid: <1205134764.8.0.415620235375.issue2263@psf.upfronthosting.co.za>
2008-03-10 07:39:23jvrlinkissue2263 messages
2008-03-10 07:39:22jvrcreate