Advertisement

PyModule_AddIntConstat problem

Started by March 31, 2015 08:44 AM
0 comments, last by SiCrane 9 years, 9 months ago
Hi dev's

I have some problem with PyModule_AddIntConstant because max value for this function si long how can i make this unsigned long long?
The problem here is that Python Integer objects can't hold the full range of an unsigned long. You need a Python Long object instead if the value falls out of range. Use PyLong_FromUnsignedLong() to create the Long object and PyModule_AddObject() to add it to the module. Alternately, if you're on a platform where size_t is at least as large as long, you can try using PyInt_FromSize_t(), which will create an Integer object if the value is small enough and a Long object if the value doesn't fit inside an Integer.

This topic is closed to new replies.

Advertisement