[Pyrex] pyCdk SystemError: Objects/longobject.c:240: bad argument to internal function

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Mar 4 05:51:10 CET 2005


Dog Walker wrote:

> linux:/home/dw/pycdk/examples # python calendar.py
> Traceback (most recent call last):
>   File "calendar.py", line 13, in ?
>     calendar = cdk.Calendar(screen, 0, 0, title, d, m, y, curses.A_BOLD, 
> curses.A_BOLD, curses.A_BOLD, curses.A_REVERSE, curses.A_REVERSE)
>   File "cdk.pyx", line 511, in cdk.Calendar.__new__
> SystemError: Objects/longobject.c:240: bad argument to internal function
> 
 > I would like to either fix pyrex 0.9.3 or pyCdk's cdk.c.

Find the place in Pyrex/Compiler/PyrexTypes.py which says

   class CULongType(CIntType):

     to_py_function = "PyLong_FromUnsignedLong"
     from_py_function = "PyLong_AsUnsignedLong"

and change "PyLong_AsUnsignedLong" to "PyInt_AsUnsignedLongMask".
(Python 2.3 or later is needed for this to work, I think.)

> (Are there older versions of Pyrex which don't raise this error?)

Yes, that particular problem shouldn't happen in 0.9.2 (but
other things may go wrong with converting Python longs
 >= 0x80000000 to C unsigned longs).

I hope to have a release out soon that will fix this.

-- 
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg.ewing at canterbury.ac.nz	   +--------------------------------------+



More information about the Pyrex mailing list