why there's no PyLong_AsString() ?

Silvio Arcangeli sarcangeli at montrouge.sema.slb.com
Wed Sep 19 11:05:38 CEST 2001


Hello,
I am dealing with Python long objects in my extension module (I use them to 
store a 64 bits non-standard integer type).
To convert the C type into a Python long I just pass through a string using 
itoa()-like function and the PyLong_FromString(),
but when I have to get back the object from Python I have no way to 
retrieve (in C) a string from it (so that I can then retrieve my variable 
with the atoi()-like function). Why is this function missing in the API?
The only C types you can get from a long object are a C long (very likely 
to overflow, of course) or a double (loss of resolution, and again possible 
overflow).
By now all I could do was to convert the long to a string in Python and 
pass the string to the C function, but it's quite an ugly solution.

ciao,
Silvio.





More information about the Python-list mailing list