[C++-sig] Avoiding implicit boost::python::extract<> conversions
It looks like boost::python::extract::check() will happily succeed on an int python object, and boost::python::extract::check() will likewise succeed on a bool python object. Is there an easy way to discover the actual python type so I can really get the data I want in the correct type? -- [email protected] www.murrayc.com www.openismus.com ___ Cplusplus-sig mailing list [email protected] http://mail.python.org/mailman/listinfo/cplusplus-sig
Re: [C++-sig] Avoiding implicit boost::python::extract<> conversions
Am Donnerstag, 7. April 2011, um 16:02:47 schrieb Murray Cumming: > It looks like boost::python::extract::check() will happily succeed > on an int python object, and boost::python::extract::check() will > likewise succeed on a bool python object. > > Is there an easy way to discover the actual python type so I can really > get the data I want in the correct type? Sure, you can use the Python/C API (PyBool_Check etc.) HTH Hans ___ Cplusplus-sig mailing list [email protected] http://mail.python.org/mailman/listinfo/cplusplus-sig
Re: [C++-sig] Avoiding implicit boost::python::extract<> conversions
If you add the undocumented (sorry) define -DBOOST_PYTHON_BOOL_INT_STRICT Boost.Python will not convert bool to int and vice versa. I have been working with this define for a couple years now with a good experience. (The main reason for the define to be undocumented is that the tests need to be adjusted, which I never found the time for.) - Original Message - > From:Murray Cumming > To:[email protected] > Cc: > Sent:Thursday, April 7, 2011 7:02 AM > Subject:[C++-sig] Avoiding implicit boost::python::extract<> conversions > > It looks like boost::python::extract::check() will happily succeed > on an int python object, and boost::python::extract::check() will > likewise succeed on a bool python object. > > Is there an easy way to discover the actual python type so I can really > get the data I want in the correct type? > > -- > [email protected] > www.murrayc.com > www.openismus.com > > ___ > Cplusplus-sig mailing list > [email protected] > http://mail.python.org/mailman/listinfo/cplusplus-sig ___ Cplusplus-sig mailing list [email protected] http://mail.python.org/mailman/listinfo/cplusplus-sig
