[C++-sig] [python] Fix for boost::python::import
Thomas Witt
witt at acm.org
Wed Mar 28 19:16:01 CEST 2007
On Mar 28, 2007, at 9:39 AM, Stefan Seefeld wrote:
> Hans Meine wrote:
>> Hi!
>>
>> Am Donnerstag, 01. März 2007 03:33:40 schrieb Stefan Seefeld:
>>> --- libs/python/src/import.cpp 27 Oct 2006 21:17:25 -0000 1.2
>>> +++ libs/python/src/import.cpp 1 Mar 2007 02:00:47 -0000
>>> @@ -17,7 +17,7 @@
>>> {
>>> // should be 'char const *' but older python versions don't
>>> use 'const'
>>> yet. char *n = python::extract<char *>(name);
>>> - python::handle<> module(python::borrowed(PyImport_AddModule(n)));
>>> + python::handle<> module(python::borrowed(PyImport_ImportModule
>>> (n)));
>>> return python::object(module);
>>> }
>>
>> I just saw your patch and looked at the docs.. isn't there a
>> borrowed() too
>> much now? In contrast to AddModule, ImportModule returns a new
>> reference
>> according to http://docs.python.org/api/importing.html
>
> Oh, duh ! (Why isn't Python written in a nicer and more convenient
> language
> that didn't require users to think about ref counting on each call ?!)
>
> Dave, Thomas,
>
> may I remove that extra python::borrowed in HEAD as well as
> RC_1_34_0 ?
Unless Dave objects, please go ahead
Thomas
--
Thomas Witt
witt at acm.org
More information about the Cplusplus-sig
mailing list