[C++-sig] Re: boolean patch for builtin_converters.hpp

David Abrahams dave at boost-consulting.com
Mon Jan 19 02:38:35 CET 2004


Daniel Holth <dholth at fastmail.fm> writes:

> On Sun, 2004-01-18 at 10:39, David Abrahams wrote:
>> Daniel Holth <dholth at fastmail.fm> writes:
>> 
>> > Here's something for fans of Python's relatively new True and False
>> > objects.
>
>> > diff -r1.22 builtin_converters.hpp
>> > 95c95
>> > < BOOST_PYTHON_TO_PYTHON_BY_VALUE(bool, ::PyInt_FromLong(x))
>> > ---
>> >> BOOST_PYTHON_TO_PYTHON_BY_VALUE(bool, ::PyBool_FromLong(x))
>> 
>> This patch will break 2.2 compatibility and possibly some of the
>> Boost.Python regression tests if we take it as-is.
>> 
>> Please try again, though; I'd like to accept a patch for this!
>
> Not too hard, this version will use the new behavior only in Pythons 2.3
> and above:
>
> // Bool is not signed.
> #if PY_VERSION_HEX >= 0x02030000
> BOOST_PYTHON_TO_PYTHON_BY_VALUE(bool, ::PyBool_FromLong(x))
> #else
> BOOST_PYTHON_TO_PYTHON_BY_VALUE(bool, ::PyInt_FromLong(x))
> #endif

Did you run the regression tests?

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com





More information about the Cplusplus-sig mailing list