[C++-sig] boost.python and numpy.int32 on 64-bit system

Ger van Diepen diepen at astron.nl
Thu Apr 17 15:10:14 CEST 2008

Hi Andreas,

Thanks for your answer.
I'll have vacation in the coming 2 weeks, so I'll await your news.
I indeed think that numpy should have returned a normal Python type.


>>> Andreas Klöckner <lists at informa.tiker.net> 04/17/08 2:52 PM >>>
On Donnerstag 17 April 2008, Ger van Diepen wrote:
>   ArgumentError: Python argument types in
>     Table.getcell(table, str, numpy.int32)
>   did not match C++ signature:
>     getcell(casa::TableProxy {lvalue}, std::string columnname, int

This is numpy's fault, as it returns what they term an 'array scalar'.
This is 
because Python's "int" on a 64-bit machine is 64 bits:

>>> 2**39
>>> 2**66

(see when the "L" shows up)

But numpy wants to return the exact data type you have in your array, so
gives you something that's not an int. As BP doesn't know about numpy by

default (and can't assume it's there), there's no support. You would
need to 
install custom (from-/to-python) rvalue converters for numpy's array
I have something in the works that might help you--watch for an
in the next few days. But for now the explicit conversion hack is
your easiest route to success.


More information about the Cplusplus-sig mailing list