[SciPy-user] Weave: Distinction between integers being either py:object or int

Justin Bayer bayer.justin@googlemail....
Tue Jan 6 09:46:09 CST 2009

Hi group,

I am currently having a problem for which I am searching a workaround.
I searched the mailinglist archives but did not find anything useful.

Consider the following code:  http://privatepaste.com/881oUqpHFJ

This will compile two different versions of the snippet. One for
number being an integer and one for it being an py::object.

I would like to have a long always in my snippet, which I could
achieve by PyInt_AsLong(), I guess. But I don't know of a way to
reliably tell wether the c++ snippet has just gotten an integer or a

Of course it would be cool, if weave would reliably convert a Python
Long to a C Long.

Any ideas for workarounds for my problem? This is really getting a
problem for me.


P.S.: No Dogs!

More information about the SciPy-user mailing list