Just tried on a 32bit workstation (both CPU and OS): I get an error, as before, using python2.5: --- a.py:5: DeprecationWarning: struct integer overflow masking is deprecated b=struct.pack("<10H",*a) Traceback (most recent call last): File "a.py", line 5, in <module> b=struct.pack("<10H",*a) File "/usr/lib/python2.5/struct.py", line 63, in pack return o.pack(*args) SystemError: ../Objects/longobject.c:322: bad argument to internal function ---- No error with python2.4 so I believe it is a 32bit issue.
HTH, Emanuele Emanuele Olivetti wrote: > Hi, > > this snippet is causing troubles: > --- > import struct > import numpy > > a=numpy.arange(10).astype('H') > b=struct.pack("<10H",*a) > --- > (The module struct simply packs and unpacks data in byte-blobs). > > It works OK with python2.4, but gives problems with python2.5. > On my laptop (linux x86_64 on intel core 2 duo) I got this warning: > --- > a.py:5: DeprecationWarning: struct integer overflow masking is deprecated > b=struct.pack("<10H",*a) > --- > > On another workstation (linux i686 on intel core 2, so a 32 bit OS on 64 bit > architecture) I got warning plus an _error_, when using python2.5 (python2.4 > works flawlessly): > --- > a.py:5: DeprecationWarning: struct integer overflow masking is deprecated > b=struct.pack("<10H",*a) > Traceback (most recent call last): > File "a.py", line 5, in <module> > b=struct.pack("<10H",*a) > File "/usr/lib/python2.5/struct.py", line 63, in pack > return o.pack(*args) > SystemError: ../Objects/longobject.c:322: bad argument to internal function > --- > > Both computers are ubuntu gutsy 7.10, updated. > Details: > python, 2.5.1-1ubuntu2 > numpy, 1:1.0.3-1ubuntu2 > Same versions on both machines. > > I did some little test _without_ numpy and the struct module seems not > having > problems. Is this a numpy bug? > Note: If you remove "<" from the struct format string then it seems to work > ok. > > Regards, > > Emanuele > > > _______________________________________________ > Numpy-discussion mailing list > Numpy-discussion@scipy.org > http://projects.scipy.org/mailman/listinfo/numpy-discussion > > _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion