PyInt_FromLong gives segfault on small numbers (<257)

M

Marcos Prieto

Hi,

I'm trying to call python (python 2.6) functions from C++ using MS VC+
+ 6.0 and any calls to PyInt_FromLong with numbers below 257 give me
exceptions, no problems with bigger numbers

PyObject *pValue;

pValue = PyInt_FromLong(1L); (or pValue = PyInt_FromLong(1);


Any ideas of what can I be doing wrong?

Thanks,

Marcos.
 
A

Antoine Pitrou

Hi,

I'm trying to call python (python 2.6) functions from C++ using MS VC+
+ 6.0 and any calls to PyInt_FromLong with numbers below 257 give me
exceptions, no problems with bigger numbers

PyObject *pValue;

pValue = PyInt_FromLong(1L); (or pValue = PyInt_FromLong(1);

Have you called Py_Initialize() before?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top