[C++-sig] [python] Fix for boost::python::import

Hans Meine meine at informatik.uni-hamburg.de
Wed Mar 28 18:07:06 CEST 2007


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

-- 
Ciao, /  /
     /--/
    /  / ANS



More information about the Cplusplus-sig mailing list