[Pyrex] Re: pyCdk SystemError: Objects/longobject.c:240: bad
argument to internal function
DogWalker
forestiero at qwest.net
Mon Mar 7 09:05:33 CET 2005
DogWalker <forestiero at qwest.net> said:
"Greg Ewing" <greg.ewing at canterbury.ac.nz> said:
>forestiero at qwest.net wrote:
>
>> Unfortunately I have another problem when I try to run the pycdk setup.py to
>> create the cdk extension from the pyrex generated cdk.c:
>
>> cdk.c:66: error: parse error before "CDKBUTTON"
>> cdk.c:66: warning: no semicolon at end of struct or union
>> cdk.c:68: error: parse error before '}' token
>> cdk.c:106: error: parse error before "CDKFSCALE"
>
>How are CDKBUTTON and CDKFSCALE declared in the .h file?
>
>How are they declared in the Pyrex code?
>
I fixed the "parse error" problem somehow.
Deleted the cdk.c and cdk.so files.
Ran setup.py install in the pycdk directory which generated
a new cdk.c and cdk.so.
Ran a couple of the pycdk examples and each failed for the original
reason.
Searching the cdk.c file, I get no hit on "PyInt_AsUnsignedLongMask".
That failure leads me to believe that the fix had no effect.
Here is what Pyrex/Compiler/PyrexTypes.py looks like now:
-----------------------------------------------------------------
class CULongType(CIntType):
to_py_function = "PyLong_FromUnsignedLong"
from_py_function = "PyInt_AsUnsignedLongMask" # from 'PyLong_AsUnsignedLong' per Greg Ewing
-----------------------------------------------------------------
Python version:
Python 2.3+ (#1, Sep 23 2003, 23:07:16)
[GCC 3.3.1 (SuSE Linux)] on linux2
I can "fix" some of examples (perhaps all) by using explicit conversion to long:
example, long(curses.A_BOLD) rather than curse.A_BOLD.
I would rather put this fix in the cdk.pyx file. That's what I was trying to do
when the "parse error" raised its ugly head. Should try again now I guess.
More information about the Pyrex
mailing list