From andyspiros at gmail.com Tue Mar 1 18:07:46 2011 From: andyspiros at gmail.com (Andrea Arteaga) Date: Tue, 1 Mar 2011 18:07:46 +0100 Subject: [C++-sig] Status of Numpy support in boost python - III Message-ID: Hello. My name is Andrea Arteaga and I'm student of Computational Science and Engineering at the ETH Zurich. I see in the wiki page and in this mailing list that you have a project whithin the Google Summer of Code program regarding Numpy support in Boost.Python and you search for interested students. Well, I'm that student! I use both Boost.Python and numpy and I'm familiar with the Python C API. I never *splashed about* in the Boost.Python source code, but I'm very curious. If you are still interested to be a mentor organization, I'm ready to spend my summer (and not only the summer: I'm also interested in becoming a regular contributor) working for this project. Best regards. Andrea Arteaga andyspiros at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefan at seefeld.name Tue Mar 1 18:24:43 2011 From: stefan at seefeld.name (Stefan Seefeld) Date: Tue, 01 Mar 2011 12:24:43 -0500 Subject: [C++-sig] Status of Numpy support in boost python - III In-Reply-To: References: Message-ID: <4D6D2BDB.8090406@seefeld.name> Hi Andrea, welcome to this community, and thank you for your interest into the GSoC program. Could you elaborate a little on what you would like to be working on, i.e. in what way you would like to improve the existing numeric support in boost.python ? Thanks, Stefan -- ...ich hab' noch einen Koffer in Berlin... From wichert at wiggy.net Tue Mar 1 23:14:22 2011 From: wichert at wiggy.net (Wichert Akkerman) Date: Tue, 01 Mar 2011 23:14:22 +0100 Subject: [C++-sig] boost::python::set missing? Message-ID: <4D6D6FBE.6000608@wiggy.net> I noticed that the standard python set type is not exposed. Are there any plans to add that? Wichert. -- Wichert Akkerman It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. From stefan at seefeld.name Wed Mar 2 00:04:48 2011 From: stefan at seefeld.name (Stefan Seefeld) Date: Tue, 01 Mar 2011 18:04:48 -0500 Subject: [C++-sig] boost::python::set missing? In-Reply-To: <4D6D6FBE.6000608@wiggy.net> References: <4D6D6FBE.6000608@wiggy.net> Message-ID: <4D6D7B90.5090709@seefeld.name> On 2011-03-01 17:14, Wichert Akkerman wrote: > I noticed that the standard python set type is not exposed. Are there > any plans to add that? I think that's a fine idea. (My guess is that it didn't make it into the boost.python API because it was added after the initial API had been designed.) Stefan -- ...ich hab' noch einen Koffer in Berlin... From rwgk at yahoo.com Wed Mar 2 00:50:12 2011 From: rwgk at yahoo.com (Ralf W. Grosse-Kunstleve) Date: Tue, 1 Mar 2011 15:50:12 -0800 (PST) Subject: [C++-sig] boost::python::set missing? In-Reply-To: <4D6D7B90.5090709@seefeld.name> References: <4D6D6FBE.6000608@wiggy.net> <4D6D7B90.5090709@seefeld.name> Message-ID: <891859.24839.qm@web111403.mail.gq1.yahoo.com> > I think that's a fine idea. (My guess is that it didn't make it into the > boost.python API because it was added after the initial API had been >designed.) That's exactly right. Boost.Python was developed when Python 2.2 had just come out. (Boost.Python 1 was even based on 1.5.2) I'm not aware of plans for adding boost::python::set, but it would be a great addition. Ralf From athanasios.dousis at protabit.com Wed Mar 2 20:17:57 2011 From: athanasios.dousis at protabit.com (Athanasios Dousis) Date: Wed, 2 Mar 2011 11:17:57 -0800 Subject: [C++-sig] compile-time macro errors when using Python 2.7.1 and Boost 1.45 on OSX 10.6.6 Message-ID: <1E889F87-65B2-424A-A2BB-27B7B6ED45BF@protabit.com> Hello all, I'm upgrading from Python 2.6.5 to 2.7.1, and I'm getting the error below when compiling my program using Boost 1.45 and gcc 4.2.1 in OSX 10.6.6. I found a thread that describes similar symptoms related to the ordering of header files and macro definitions: http://code.google.com/p/unladen-swallow/issues/detail?id=87#c13 The suggested patch to pyport.h (http://codereview.appspot.com/179049/patch/1/2) does not fix my problem, presumably because I'm not using FreeBSD. However, adding #include "Python.h" to the top of each source file (e.g., bend.cc below) does fix the problem. Is there a simple way to fix this without adding Python.h to every source file in my codebase? I've installed Boost and Python from source to non-standard directories, Boost 1.45 by: cd $(BOOST); ./bootstrap.sh --prefix=$(CURDIR)/$(BOOST) --with-python-root=$(CURDIR)/$(PYTHON_DIR) --with-python-version=2.7 --with-libraries=mpi and Python 2.7 by: cd $(PYTHON_SRCDIR) ; ./configure --enable-shared --prefix=$(CURDIR)/$(PYTHON_DIR) cd $(PYTHON_SRCDIR) ; make -j $(NUMPROC) && make install Any guidance will be greatly appreciated. Kind regards, Nasos =============== ... darwin.compile.c++ bin/darwin-4.2.1/release/threading-multi/bend.o In file included from /usr/include/c++/4.2.1/ios:47, from /usr/include/c++/4.2.1/ostream:45, from /usr/include/c++/4.2.1/iterator:70, from boost/boost/next_prior.hpp:15, from boost/boost/utility.hpp:17, from boost/boost/python/instance_holder.hpp:10, from boost/boost/python/object/pointer_holder.hpp:14, from boost/boost/python/to_python_indirect.hpp:10, from boost/boost/python/converter/arg_to_python.hpp:10, from boost/boost/python/call.hpp:15, from boost/boost/python/object_core.hpp:14, from boost/boost/python/args.hpp:25, from boost/boost/python.hpp:11, from bend.hh:6, from bend.cc:1: /usr/include/c++/4.2.1/bits/localefwd.h:58:34: error: macro "isspace" passed 2 arguments, but takes just 1 /usr/include/c++/4.2.1/bits/localefwd.h:70:34: error: macro "isupper" passed 2 arguments, but takes just 1 /usr/include/c++/4.2.1/bits/localefwd.h:74:34: error: macro "islower" passed 2 arguments, but takes just 1 /usr/include/c++/4.2.1/bits/localefwd.h:78:34: error: macro "isalpha" passed 2 arguments, but takes just 1 /usr/include/c++/4.2.1/bits/localefwd.h:94:34: error: macro "isalnum" passed 2 arguments, but takes just 1 /usr/include/c++/4.2.1/bits/localefwd.h:102:34: error: macro "toupper" passed 2 arguments, but takes just 1 /usr/include/c++/4.2.1/bits/localefwd.h:106:34: error: macro "tolower" passed 2 arguments, but takes just 1 In file included from /usr/include/c++/4.2.1/bits/basic_ios.h:44, from /usr/include/c++/4.2.1/ios:50, from /usr/include/c++/4.2.1/ostream:45, from /usr/include/c++/4.2.1/iterator:70, from boost/boost/next_prior.hpp:15, from boost/boost/utility.hpp:17, from boost/boost/python/instance_holder.hpp:10, from boost/boost/python/object/pointer_holder.hpp:14, from boost/boost/python/to_python_indirect.hpp:10, from boost/boost/python/converter/arg_to_python.hpp:10, from boost/boost/python/call.hpp:15, from boost/boost/python/object_core.hpp:14, from boost/boost/python/args.hpp:25, from boost/boost/python.hpp:11, from bend.hh:6, from bend.cc:1: /usr/include/c++/4.2.1/bits/locale_facets.h:242:53: error: macro "toupper" passed 2 arguments, but takes just 1 /usr/include/c++/4.2.1/bits/locale_facets.h:271:53: error: macro "tolower" passed 2 arguments, but takes just 1 /usr/include/c++/4.2.1/bits/locale_facets.h:814:53: error: macro "toupper" passed 2 arguments, but takes just 1 /usr/include/c++/4.2.1/bits/locale_facets.h:847:53: error: macro "tolower" passed 2 arguments, but takes just 1 /usr/include/c++/4.2.1/bits/locale_facets.h:4611:44: error: macro "isspace" passed 2 arguments, but takes just 1 /usr/include/c++/4.2.1/bits/locale_facets.h:4629:44: error: macro "isupper" passed 2 arguments, but takes just 1 /usr/include/c++/4.2.1/bits/locale_facets.h:4635:44: error: macro "islower" passed 2 arguments, but takes just 1 /usr/include/c++/4.2.1/bits/locale_facets.h:4641:44: error: macro "isalpha" passed 2 arguments, but takes just 1 /usr/include/c++/4.2.1/bits/locale_facets.h:4665:44: error: macro "isalnum" passed 2 arguments, but takes just 1 /usr/include/c++/4.2.1/bits/locale_facets.h:4677:44: error: macro "toupper" passed 2 arguments, but takes just 1 /usr/include/c++/4.2.1/bits/locale_facets.h:4683:44: error: macro "tolower" passed 2 arguments, but takes just 1 In file included from /usr/include/c++/4.2.1/ios:47, from /usr/include/c++/4.2.1/ostream:45, from /usr/include/c++/4.2.1/iterator:70, from boost/boost/next_prior.hpp:15, from boost/boost/utility.hpp:17, from boost/boost/python/instance_holder.hpp:10, from boost/boost/python/object/pointer_holder.hpp:14, from boost/boost/python/to_python_indirect.hpp:10, from boost/boost/python/converter/arg_to_python.hpp:10, from boost/boost/python/call.hpp:15, from boost/boost/python/object_core.hpp:14, from boost/boost/python/args.hpp:25, from boost/boost/python.hpp:11, from bend.hh:6, from bend.cc:1: /usr/include/c++/4.2.1/bits/localefwd.h:58: error: ?std::isspace? declared as an ?inline? variable /usr/include/c++/4.2.1/bits/localefwd.h:58: error: template declaration of ?bool std::isspace? /usr/include/c++/4.2.1/bits/localefwd.h:70: error: ?std::isupper? declared as an ?inline? variable /usr/include/c++/4.2.1/bits/localefwd.h:70: error: template declaration of ?bool std::isupper? /usr/include/c++/4.2.1/bits/localefwd.h:74: error: ?std::islower? declared as an ?inline? variable /usr/include/c++/4.2.1/bits/localefwd.h:74: error: template declaration of ?bool std::islower? /usr/include/c++/4.2.1/bits/localefwd.h:78: error: ?std::isalpha? declared as an ?inline? variable /usr/include/c++/4.2.1/bits/localefwd.h:78: error: template declaration of ?bool std::isalpha? /usr/include/c++/4.2.1/bits/localefwd.h:94: error: ?std::isalnum? declared as an ?inline? variable /usr/include/c++/4.2.1/bits/localefwd.h:94: error: template declaration of ?bool std::isalnum? /usr/include/c++/4.2.1/bits/localefwd.h:102: error: ?std::toupper? declared as an ?inline? variable /usr/include/c++/4.2.1/bits/localefwd.h:102: error: template declaration of ?_CharT std::toupper? /usr/include/c++/4.2.1/bits/localefwd.h:106: error: ?std::tolower? declared as an ?inline? variable /usr/include/c++/4.2.1/bits/localefwd.h:106: error: template declaration of ?_CharT std::tolower? In file included from /usr/include/c++/4.2.1/bits/basic_ios.h:44, from /usr/include/c++/4.2.1/ios:50, from /usr/include/c++/4.2.1/ostream:45, from /usr/include/c++/4.2.1/iterator:70, from boost/boost/next_prior.hpp:15, from boost/boost/utility.hpp:17, from boost/boost/python/instance_holder.hpp:10, from boost/boost/python/object/pointer_holder.hpp:14, from boost/boost/python/to_python_indirect.hpp:10, from boost/boost/python/converter/arg_to_python.hpp:10, from boost/boost/python/call.hpp:15, from boost/boost/python/object_core.hpp:14, from boost/boost/python/args.hpp:25, from boost/boost/python.hpp:11, from bend.hh:6, from bend.cc:1: /usr/include/c++/4.2.1/bits/locale_facets.h:227: error: ?btowc? is not a type /usr/include/c++/4.2.1/bits/locale_facets.h:242: error: expected ?;? before ?const? /usr/include/c++/4.2.1/bits/locale_facets.h:255: error: expected `;' before ?char_type? /usr/include/c++/4.2.1/bits/locale_facets.h:256: error: ?btowc? is not a type /usr/include/c++/4.2.1/bits/locale_facets.h:271: error: expected ?;? before ?const? /usr/include/c++/4.2.1/bits/locale_facets.h:287: error: expected `;' before ?char_type? /usr/include/c++/4.2.1/bits/locale_facets.h: In member function ?_CharT std::__ctype_abstract_base<_CharT>::towupper(int (*)(_CharT)) const?: /usr/include/c++/4.2.1/bits/locale_facets.h:228: error: ?__c? was not declared in this scope /usr/include/c++/4.2.1/bits/locale_facets.h: In member function ?_CharT std::__ctype_abstract_base<_CharT>::towlower(int (*)(_CharT)) const?: /usr/include/c++/4.2.1/bits/locale_facets.h:257: error: ?__c? was not declared in this scope /usr/include/c++/4.2.1/bits/locale_facets.h: At global scope: /usr/include/c++/4.2.1/bits/locale_facets.h:797: error: ?btowc? is not a type /usr/include/c++/4.2.1/bits/locale_facets.h:814: error: expected ?;? before ?const? /usr/include/c++/4.2.1/bits/locale_facets.h:829: error: expected `;' before ?char_type? /usr/include/c++/4.2.1/bits/locale_facets.h:830: error: ?btowc? is not a type /usr/include/c++/4.2.1/bits/locale_facets.h:847: error: expected ?;? before ?const? /usr/include/c++/4.2.1/bits/locale_facets.h:866: error: expected `;' before ?char_type? /usr/include/c++/4.2.1/bits/locale_facets.h: In member function ?char std::ctype::towupper(int (*)(char)) const?: /usr/include/c++/4.2.1/bits/locale_facets.h:798: error: ?__c? was not declared in this scope /usr/include/c++/4.2.1/bits/locale_facets.h: In member function ?char std::ctype::towlower(int (*)(char)) const?: /usr/include/c++/4.2.1/bits/locale_facets.h:831: error: ?__c? was not declared in this scope In file included from /usr/include/c++/4.2.1/bits/basic_ios.h:44, from /usr/include/c++/4.2.1/ios:50, from /usr/include/c++/4.2.1/ostream:45, from /usr/include/c++/4.2.1/iterator:70, from boost/boost/next_prior.hpp:15, from boost/boost/utility.hpp:17, from boost/boost/python/instance_holder.hpp:10, from boost/boost/python/object/pointer_holder.hpp:14, from boost/boost/python/to_python_indirect.hpp:10, from boost/boost/python/converter/arg_to_python.hpp:10, from boost/boost/python/call.hpp:15, from boost/boost/python/object_core.hpp:14, from boost/boost/python/args.hpp:25, from boost/boost/python.hpp:11, from bend.hh:6, from bend.cc:1: /usr/include/c++/4.2.1/bits/locale_facets.h: At global scope: /usr/include/c++/4.2.1/bits/locale_facets.h:4611: error: function definition does not declare parameters /usr/include/c++/4.2.1/bits/locale_facets.h:4629: error: function definition does not declare parameters /usr/include/c++/4.2.1/bits/locale_facets.h:4635: error: function definition does not declare parameters /usr/include/c++/4.2.1/bits/locale_facets.h:4641: error: function definition does not declare parameters /usr/include/c++/4.2.1/bits/locale_facets.h:4665: error: function definition does not declare parameters /usr/include/c++/4.2.1/bits/locale_facets.h:4677: error: function definition does not declare parameters /usr/include/c++/4.2.1/bits/locale_facets.h:4683: error: function definition does not declare parameters "g++" -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -g -dynamic -no-cpp-precomp -gdwarf-2 -fPIC -Wstrict-aliasing=2 -ffast-math -fno-strict-aliasing -DBOOST_PYTHON_MAX_ARITY=30 -D_REENTRANT -I"boost" -I"python/include/python2.7" -c -o "bin/darwin-4.2.1/release/threading-multi/Dbend.o" "bend.cc" ...failed darwin.compile.c++ bin/darwin-4.2.1/release/threading-multi/bend.o... -------------- next part -------------- An HTML attachment was scrubbed... URL: From adrian.baetu at plato-ag.com Thu Mar 3 11:07:26 2011 From: adrian.baetu at plato-ag.com (AdrianB) Date: Thu, 3 Mar 2011 10:07:26 +0000 (UTC) Subject: [C++-sig] =?utf-8?q?init=3C_LPCTSTR_=3E_error_if_used_in_static_m?= =?utf-8?q?ember_of_same=09class?= References: Message-ID: AdrianB plato-ag.com> writes: I finally found one reason for this behaviour... In my Module I included json-spirit, also based on boost. We have a helper methods gathered into a Include file. And there I found using namespace boost; using namespace json-spirit; Although my CPP File states first: using namespace boost::python; The init<>() construct seems to be allready devined in boost or json-spirit but in a different way. The solution was to explicitly qualifiy init<>(): boost::python::init<>() Of course we have to remove the "using namespace" statements out of the include file since it prooved to be bad practice ;o) From wichert at wiggy.net Fri Mar 4 09:47:04 2011 From: wichert at wiggy.net (Wichert Akkerman) Date: Fri, 04 Mar 2011 09:47:04 +0100 Subject: [C++-sig] boost::python::set missing? In-Reply-To: <891859.24839.qm@web111403.mail.gq1.yahoo.com> References: <4D6D6FBE.6000608@wiggy.net> <4D6D7B90.5090709@seefeld.name> <891859.24839.qm@web111403.mail.gq1.yahoo.com> Message-ID: <4D70A708.1040604@wiggy.net> On 3/2/11 00:50 , Ralf W. Grosse-Kunstleve wrote: >> I think that's a fine idea. (My guess is that it didn't make it into the >> boost.python API because it was added after the initial API had been >> designed.) > > > That's exactly right. Boost.Python was developed when Python 2.2 had just come > out. (Boost.Python 1 was even based on 1.5.2) Looking at the code a lot of it still assumes a pre-python 2.2 C API. What is the minimal python version that must be supported? If that is python 2.4 or later I can try to do a little cleanup and try to add some set wrappers. Wichert. From rwgk at yahoo.com Fri Mar 4 17:17:53 2011 From: rwgk at yahoo.com (Ralf W. Grosse-Kunstleve) Date: Fri, 4 Mar 2011 08:17:53 -0800 (PST) Subject: [C++-sig] boost::python::set missing? In-Reply-To: <4D70A708.1040604@wiggy.net> References: <4D6D6FBE.6000608@wiggy.net> <4D6D7B90.5090709@seefeld.name> <891859.24839.qm@web111403.mail.gq1.yahoo.com> <4D70A708.1040604@wiggy.net> Message-ID: <540359.26233.qm@web111404.mail.gq1.yahoo.com> > Looking at the code a lot of it still assumes a pre-python 2.2 C API. What is > the minimal python version that must be supported? If that is python 2.4 or > later I can try to do a little cleanup and try to add some set wrappers. I'd support giving up on Python versions before 2.4. Ralf From stefan at seefeld.name Fri Mar 4 17:25:00 2011 From: stefan at seefeld.name (Stefan Seefeld) Date: Fri, 04 Mar 2011 11:25:00 -0500 Subject: [C++-sig] boost::python::set missing? In-Reply-To: <540359.26233.qm@web111404.mail.gq1.yahoo.com> References: <4D6D6FBE.6000608@wiggy.net> <4D6D7B90.5090709@seefeld.name> <891859.24839.qm@web111403.mail.gq1.yahoo.com> <4D70A708.1040604@wiggy.net> <540359.26233.qm@web111404.mail.gq1.yahoo.com> Message-ID: <4D71125C.7040609@seefeld.name> On 2011-03-04 11:17, Ralf W. Grosse-Kunstleve wrote: >> Looking at the code a lot of it still assumes a pre-python 2.2 C API. What is >> the minimal python version that must be supported? If that is python 2.4 or >> later I can try to do a little cleanup and try to add some set wrappers. > > I'd support giving up on Python versions before 2.4. That seems reasonable to me, too. Stefan -- ...ich hab' noch einen Koffer in Berlin... From rymurr at gmail.com Mon Mar 7 17:03:25 2011 From: rymurr at gmail.com (Ryan Murray) Date: Mon, 7 Mar 2011 16:03:25 +0000 Subject: [C++-sig] boost python exception handling Message-ID: Hi All, I am testing boost python with the following code: #include #include #include using namespace boost::python; int pyrun_main(); BOOST_PYTHON_MODULE(testing) { def("pyrun_main",pyrun_main); } int pyrun_main(){ try{ throw std::exception(); } catch(std::exception &e){ std::cout << "fun!" << std::endl; } return 1; } I compile it with: g++ boostpy.cpp -I/usr/include/python2.6/ -lpython2.6 -fPIC -shared -Wl,-soname,libclassical.so -o libclassical.so and import it into python without problems. When running pyrun_main() I get a Segmentation Fault. and no other useful output. I have tried on python 2.6 and 2.7 on Linux and OSX. And have tried g++,clang,icpc compilers. On boost 1.44,1.45 and 1.46. Perhaps I am missing something very simple but I cant find any reason why this won't run. I have other code that does not throw and works fine. Thanks Ryan From austin.bingham at gmail.com Tue Mar 8 09:00:50 2011 From: austin.bingham at gmail.com (Austin Bingham) Date: Tue, 8 Mar 2011 09:00:50 +0100 Subject: [C++-sig] boost python exception handling In-Reply-To: References: Message-ID: Hi Ryan, I tried out your code (g++, python2.6, boost-1.40) and it worked just fine. However, I had to make a few changes to your compilation command to get it working. The python module you're defining is called "testing", but your command is generating a "libclassical.so"; you need to output "testing.so" (no leading 'lib') for python to import it/associate it with the module "testing". Is it possible that you're actually loading a module from some old build or something? Other than that, I can't see any problems. Can you possibly post a stack trace? Austin On Mon, Mar 7, 2011 at 5:03 PM, Ryan Murray wrote: > Hi All, > > I am testing boost python with the following code: > > > #include > #include > #include > > using namespace boost::python; > > int pyrun_main(); > > BOOST_PYTHON_MODULE(testing) > { > ? ?def("pyrun_main",pyrun_main); > } > > int pyrun_main(){ > ? ?try{ > ? ? ? ?throw std::exception(); > ? ?} > ? ?catch(std::exception &e){ > ? ? ? ?std::cout << "fun!" << std::endl; > ? ?} > > ? ?return 1; > } > > > I compile it with: > > g++ boostpy.cpp -I/usr/include/python2.6/ -lpython2.6 -fPIC ? -shared > -Wl,-soname,libclassical.so -o libclassical.so > > and import it into python without problems. When running pyrun_main() > I get a Segmentation Fault. and no other useful output. I have tried > on python 2.6 and 2.7 on Linux and OSX. And have tried g++,clang,icpc > compilers. On boost 1.44,1.45 and 1.46. > Perhaps I am missing something very simple but I cant find any reason > why this won't run. I have other code that does not throw and works > fine. > > Thanks > Ryan > _______________________________________________ > Cplusplus-sig mailing list > Cplusplus-sig at python.org > http://mail.python.org/mailman/listinfo/cplusplus-sig > From rymurr at gmail.com Wed Mar 9 20:50:25 2011 From: rymurr at gmail.com (Ryan Murray) Date: Wed, 9 Mar 2011 19:50:25 +0000 Subject: [C++-sig] Cplusplus-sig Digest, Vol 30, Issue 6 In-Reply-To: References: Message-ID: Hi Austin, Thanks for the reply. The lines you changed in my compile command were actually how I was compiling as well. I just copied the wrong line into the email. On my Linux box the problem was being caused by an old set of boost libraries compiled with an older intel compiler. On OSX, I am not certain exactly but it seems that I was linking the module against a python2.6 library but boost_python had been built with the 2.7 library or there was a mismatch with headers or something else strange. So I feel much better now that a program I thought should work does. One follow up question, if i link the library using -Wl,-soname,libtest.so then move the file to test.so does that make a difference when importing and using it? Thanks for your help, Ryan On Tue, Mar 8, 2011 at 11:00 AM, wrote: > Hi Ryan, > > I tried out your code (g++, python2.6, boost-1.40) and it worked just > fine. However, I had to make a few changes to your compilation command > to get it working. The python module you're defining is called > "testing", but your command is generating a "libclassical.so"; you > need to output "testing.so" (no leading 'lib') for python to import > it/associate it with the module "testing". Is it possible that you're > actually loading a module from some old build or something? > > Other than that, I can't see any problems. Can you possibly post a stack trace? > > Austin > > On Mon, Mar 7, 2011 at 5:03 PM, Ryan Murray wrote: >> Hi All, >> >> I am testing boost python with the following code: >> >> >> #include >> #include >> #include >> >> using namespace boost::python; >> >> int pyrun_main(); >> >> BOOST_PYTHON_MODULE(testing) >> { >> ? ?def("pyrun_main",pyrun_main); >> } >> >> int pyrun_main(){ >> ? ?try{ >> ? ? ? ?throw std::exception(); >> ? ?} >> ? ?catch(std::exception &e){ >> ? ? ? ?std::cout << "fun!" << std::endl; >> ? ?} >> >> ? ?return 1; >> } >> >> >> I compile it with: >> >> g++ boostpy.cpp -I/usr/include/python2.6/ -lpython2.6 -fPIC ? -shared >> -Wl,-soname,libclassical.so -o libclassical.so >> >> and import it into python without problems. When running pyrun_main() >> I get a Segmentation Fault. and no other useful output. I have tried >> on python 2.6 and 2.7 on Linux and OSX. And have tried g++,clang,icpc >> compilers. On boost 1.44,1.45 and 1.46. >> Perhaps I am missing something very simple but I cant find any reason >> why this won't run. I have other code that does not throw and works >> fine. >> >> Thanks >> Ryan >> _______________________________________________ >> Cplusplus-sig mailing list >> Cplusplus-sig at python.org >> http://mail.python.org/mailman/listinfo/cplusplus-sig >> From athanasios.dousis at protabit.com Thu Mar 10 00:49:49 2011 From: athanasios.dousis at protabit.com (Athanasios Dousis) Date: Wed, 9 Mar 2011 15:49:49 -0800 Subject: [C++-sig] compile-time macro errors when using Python 2.7.1 and Boost 1.45 on OSX 10.6.6 In-Reply-To: <1E889F87-65B2-424A-A2BB-27B7B6ED45BF@protabit.com> References: <1E889F87-65B2-424A-A2BB-27B7B6ED45BF@protabit.com> Message-ID: <0D8468FA-AA87-4761-92E5-E4B8A809D26F@protabit.com> I've appended this issue to the Python bug tracker http://bugs.python.org/issue10910 On Mar 2, 2011, at 11:17 AM, Athanasios Dousis wrote: > Hello all, > > I'm upgrading from Python 2.6.5 to 2.7.1, and I'm getting the error below when compiling my program using Boost 1.45 and gcc 4.2.1 in OSX 10.6.6. I found a thread that describes similar symptoms related to the ordering of header files and macro definitions: > http://code.google.com/p/unladen-swallow/issues/detail?id=87#c13 > > The suggested patch to pyport.h (http://codereview.appspot.com/179049/patch/1/2) does not fix my problem, presumably because I'm not using FreeBSD. However, adding #include "Python.h" to the top of each source file (e.g., bend.cc below) does fix the problem. Is there a simple way to fix this without adding Python.h to every source file in my codebase? > > I've installed Boost and Python from source to non-standard directories, Boost 1.45 by: > cd $(BOOST); ./bootstrap.sh --prefix=$(CURDIR)/$(BOOST) --with-python-root=$(CURDIR)/$(PYTHON_DIR) --with-python-version=2.7 --with-libraries=mpi > > and Python 2.7 by: > cd $(PYTHON_SRCDIR) ; ./configure --enable-shared --prefix=$(CURDIR)/$(PYTHON_DIR) > cd $(PYTHON_SRCDIR) ; make -j $(NUMPROC) && make install > > Any guidance will be greatly appreciated. > > Kind regards, > Nasos > > =============== > ... > darwin.compile.c++ bin/darwin-4.2.1/release/threading-multi/bend.o > In file included from /usr/include/c++/4.2.1/ios:47, > from /usr/include/c++/4.2.1/ostream:45, > from /usr/include/c++/4.2.1/iterator:70, > from boost/boost/next_prior.hpp:15, > from boost/boost/utility.hpp:17, > from boost/boost/python/instance_holder.hpp:10, > from boost/boost/python/object/pointer_holder.hpp:14, > from boost/boost/python/to_python_indirect.hpp:10, > from boost/boost/python/converter/arg_to_python.hpp:10, > from boost/boost/python/call.hpp:15, > from boost/boost/python/object_core.hpp:14, > from boost/boost/python/args.hpp:25, > from boost/boost/python.hpp:11, > from bend.hh:6, > from bend.cc:1: > /usr/include/c++/4.2.1/bits/localefwd.h:58:34: error: macro "isspace" passed 2 arguments, but takes just 1 > /usr/include/c++/4.2.1/bits/localefwd.h:70:34: error: macro "isupper" passed 2 arguments, but takes just 1 > /usr/include/c++/4.2.1/bits/localefwd.h:74:34: error: macro "islower" passed 2 arguments, but takes just 1 > /usr/include/c++/4.2.1/bits/localefwd.h:78:34: error: macro "isalpha" passed 2 arguments, but takes just 1 > /usr/include/c++/4.2.1/bits/localefwd.h:94:34: error: macro "isalnum" passed 2 arguments, but takes just 1 > /usr/include/c++/4.2.1/bits/localefwd.h:102:34: error: macro "toupper" passed 2 arguments, but takes just 1 > /usr/include/c++/4.2.1/bits/localefwd.h:106:34: error: macro "tolower" passed 2 arguments, but takes just 1 > In file included from /usr/include/c++/4.2.1/bits/basic_ios.h:44, > from /usr/include/c++/4.2.1/ios:50, > from /usr/include/c++/4.2.1/ostream:45, > from /usr/include/c++/4.2.1/iterator:70, > from boost/boost/next_prior.hpp:15, > from boost/boost/utility.hpp:17, > from boost/boost/python/instance_holder.hpp:10, > from boost/boost/python/object/pointer_holder.hpp:14, > from boost/boost/python/to_python_indirect.hpp:10, > from boost/boost/python/converter/arg_to_python.hpp:10, > from boost/boost/python/call.hpp:15, > from boost/boost/python/object_core.hpp:14, > from boost/boost/python/args.hpp:25, > from boost/boost/python.hpp:11, > from bend.hh:6, > from bend.cc:1: > /usr/include/c++/4.2.1/bits/locale_facets.h:242:53: error: macro "toupper" passed 2 arguments, but takes just 1 > /usr/include/c++/4.2.1/bits/locale_facets.h:271:53: error: macro "tolower" passed 2 arguments, but takes just 1 > /usr/include/c++/4.2.1/bits/locale_facets.h:814:53: error: macro "toupper" passed 2 arguments, but takes just 1 > /usr/include/c++/4.2.1/bits/locale_facets.h:847:53: error: macro "tolower" passed 2 arguments, but takes just 1 > /usr/include/c++/4.2.1/bits/locale_facets.h:4611:44: error: macro "isspace" passed 2 arguments, but takes just 1 > /usr/include/c++/4.2.1/bits/locale_facets.h:4629:44: error: macro "isupper" passed 2 arguments, but takes just 1 > /usr/include/c++/4.2.1/bits/locale_facets.h:4635:44: error: macro "islower" passed 2 arguments, but takes just 1 > /usr/include/c++/4.2.1/bits/locale_facets.h:4641:44: error: macro "isalpha" passed 2 arguments, but takes just 1 > /usr/include/c++/4.2.1/bits/locale_facets.h:4665:44: error: macro "isalnum" passed 2 arguments, but takes just 1 > /usr/include/c++/4.2.1/bits/locale_facets.h:4677:44: error: macro "toupper" passed 2 arguments, but takes just 1 > /usr/include/c++/4.2.1/bits/locale_facets.h:4683:44: error: macro "tolower" passed 2 arguments, but takes just 1 > In file included from /usr/include/c++/4.2.1/ios:47, > from /usr/include/c++/4.2.1/ostream:45, > from /usr/include/c++/4.2.1/iterator:70, > from boost/boost/next_prior.hpp:15, > from boost/boost/utility.hpp:17, > from boost/boost/python/instance_holder.hpp:10, > from boost/boost/python/object/pointer_holder.hpp:14, > from boost/boost/python/to_python_indirect.hpp:10, > from boost/boost/python/converter/arg_to_python.hpp:10, > from boost/boost/python/call.hpp:15, > from boost/boost/python/object_core.hpp:14, > from boost/boost/python/args.hpp:25, > from boost/boost/python.hpp:11, > from bend.hh:6, > from bend.cc:1: > /usr/include/c++/4.2.1/bits/localefwd.h:58: error: ?std::isspace? declared as an ?inline? variable > /usr/include/c++/4.2.1/bits/localefwd.h:58: error: template declaration of ?bool std::isspace? > /usr/include/c++/4.2.1/bits/localefwd.h:70: error: ?std::isupper? declared as an ?inline? variable > /usr/include/c++/4.2.1/bits/localefwd.h:70: error: template declaration of ?bool std::isupper? > /usr/include/c++/4.2.1/bits/localefwd.h:74: error: ?std::islower? declared as an ?inline? variable > /usr/include/c++/4.2.1/bits/localefwd.h:74: error: template declaration of ?bool std::islower? > /usr/include/c++/4.2.1/bits/localefwd.h:78: error: ?std::isalpha? declared as an ?inline? variable > /usr/include/c++/4.2.1/bits/localefwd.h:78: error: template declaration of ?bool std::isalpha? > /usr/include/c++/4.2.1/bits/localefwd.h:94: error: ?std::isalnum? declared as an ?inline? variable > /usr/include/c++/4.2.1/bits/localefwd.h:94: error: template declaration of ?bool std::isalnum? > /usr/include/c++/4.2.1/bits/localefwd.h:102: error: ?std::toupper? declared as an ?inline? variable > /usr/include/c++/4.2.1/bits/localefwd.h:102: error: template declaration of ?_CharT std::toupper? > /usr/include/c++/4.2.1/bits/localefwd.h:106: error: ?std::tolower? declared as an ?inline? variable > /usr/include/c++/4.2.1/bits/localefwd.h:106: error: template declaration of ?_CharT std::tolower? > In file included from /usr/include/c++/4.2.1/bits/basic_ios.h:44, > from /usr/include/c++/4.2.1/ios:50, > from /usr/include/c++/4.2.1/ostream:45, > from /usr/include/c++/4.2.1/iterator:70, > from boost/boost/next_prior.hpp:15, > from boost/boost/utility.hpp:17, > from boost/boost/python/instance_holder.hpp:10, > from boost/boost/python/object/pointer_holder.hpp:14, > from boost/boost/python/to_python_indirect.hpp:10, > from boost/boost/python/converter/arg_to_python.hpp:10, > from boost/boost/python/call.hpp:15, > from boost/boost/python/object_core.hpp:14, > from boost/boost/python/args.hpp:25, > from boost/boost/python.hpp:11, > from bend.hh:6, > from bend.cc:1: > /usr/include/c++/4.2.1/bits/locale_facets.h:227: error: ?btowc? is not a type > /usr/include/c++/4.2.1/bits/locale_facets.h:242: error: expected ?;? before ?const? > /usr/include/c++/4.2.1/bits/locale_facets.h:255: error: expected `;' before ?char_type? > /usr/include/c++/4.2.1/bits/locale_facets.h:256: error: ?btowc? is not a type > /usr/include/c++/4.2.1/bits/locale_facets.h:271: error: expected ?;? before ?const? > /usr/include/c++/4.2.1/bits/locale_facets.h:287: error: expected `;' before ?char_type? > /usr/include/c++/4.2.1/bits/locale_facets.h: In member function ?_CharT std::__ctype_abstract_base<_CharT>::towupper(int (*)(_CharT)) const?: > /usr/include/c++/4.2.1/bits/locale_facets.h:228: error: ?__c? was not declared in this scope > /usr/include/c++/4.2.1/bits/locale_facets.h: In member function ?_CharT std::__ctype_abstract_base<_CharT>::towlower(int (*)(_CharT)) const?: > /usr/include/c++/4.2.1/bits/locale_facets.h:257: error: ?__c? was not declared in this scope > /usr/include/c++/4.2.1/bits/locale_facets.h: At global scope: > /usr/include/c++/4.2.1/bits/locale_facets.h:797: error: ?btowc? is not a type > /usr/include/c++/4.2.1/bits/locale_facets.h:814: error: expected ?;? before ?const? > /usr/include/c++/4.2.1/bits/locale_facets.h:829: error: expected `;' before ?char_type? > /usr/include/c++/4.2.1/bits/locale_facets.h:830: error: ?btowc? is not a type > /usr/include/c++/4.2.1/bits/locale_facets.h:847: error: expected ?;? before ?const? > /usr/include/c++/4.2.1/bits/locale_facets.h:866: error: expected `;' before ?char_type? > /usr/include/c++/4.2.1/bits/locale_facets.h: In member function ?char std::ctype::towupper(int (*)(char)) const?: > /usr/include/c++/4.2.1/bits/locale_facets.h:798: error: ?__c? was not declared in this scope > /usr/include/c++/4.2.1/bits/locale_facets.h: In member function ?char std::ctype::towlower(int (*)(char)) const?: > /usr/include/c++/4.2.1/bits/locale_facets.h:831: error: ?__c? was not declared in this scope > In file included from /usr/include/c++/4.2.1/bits/basic_ios.h:44, > from /usr/include/c++/4.2.1/ios:50, > from /usr/include/c++/4.2.1/ostream:45, > from /usr/include/c++/4.2.1/iterator:70, > from boost/boost/next_prior.hpp:15, > from boost/boost/utility.hpp:17, > from boost/boost/python/instance_holder.hpp:10, > from boost/boost/python/object/pointer_holder.hpp:14, > from boost/boost/python/to_python_indirect.hpp:10, > from boost/boost/python/converter/arg_to_python.hpp:10, > from boost/boost/python/call.hpp:15, > from boost/boost/python/object_core.hpp:14, > from boost/boost/python/args.hpp:25, > from boost/boost/python.hpp:11, > from bend.hh:6, > from bend.cc:1: > /usr/include/c++/4.2.1/bits/locale_facets.h: At global scope: > /usr/include/c++/4.2.1/bits/locale_facets.h:4611: error: function definition does not declare parameters > /usr/include/c++/4.2.1/bits/locale_facets.h:4629: error: function definition does not declare parameters > /usr/include/c++/4.2.1/bits/locale_facets.h:4635: error: function definition does not declare parameters > /usr/include/c++/4.2.1/bits/locale_facets.h:4641: error: function definition does not declare parameters > /usr/include/c++/4.2.1/bits/locale_facets.h:4665: error: function definition does not declare parameters > /usr/include/c++/4.2.1/bits/locale_facets.h:4677: error: function definition does not declare parameters > /usr/include/c++/4.2.1/bits/locale_facets.h:4683: error: function definition does not declare parameters > > "g++" -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -g -dynamic -no-cpp-precomp -gdwarf-2 -fPIC -Wstrict-aliasing=2 -ffast-math -fno-strict-aliasing -DBOOST_PYTHON_MAX_ARITY=30 -D_REENTRANT -I"boost" -I"python/include/python2.7" -c -o "bin/darwin-4.2.1/release/threading-multi/Dbend.o" "bend.cc" > > ...failed darwin.compile.c++ bin/darwin-4.2.1/release/threading-multi/bend.o... > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sourlandsoftware at gmail.com Tue Mar 15 12:53:17 2011 From: sourlandsoftware at gmail.com (Rich A) Date: Tue, 15 Mar 2011 07:53:17 -0400 Subject: [C++-sig] problem importing PyEphem when using Python in debug mode. Message-ID: Okay, I'm stumped, and I'm hoping someone here can help me. I'm writing a C++ wrapper for PyEphem so I've built a debug version of Python for development. When I import PyEphem in the release Python version, no problem. But using the debug version I get the error: No module named _libastro. Here's what I'm seeing: c:\python27> c:\python27>python Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on Type "help", "copyright", "credits" or "license" for more information. >>> import ephem >>> c:\python27>python_d Python 2.7.1 (r271:86832, Mar 9 2011, 08:13:52) [MSC v.1500 32 bit (Intel)] on Type "help", "copyright", "credits" or "license" for more information. >>> import ephem Traceback (most recent call last): File "", line 1, in File "c:\python27\lib\site-packages\ephem\__init__.py", line 5, in import ephem._libastro as _libastro ImportError: No module named _libastro [43417 refs] >>> __init__.py, line 5 indeed, does import ephem._libastro as _libastro, but why does it work for the release version and not the debug version? Nothings moved, all I did was add python_d.exe and python27_d.dll to the c:\python27 directory. There must be some mechanism for locating modules that hasn't/isn't being configured with the debug executable. I know this has got to be simple but it's driving me to distraction. Thanks in advance for any help. -------------- next part -------------- An HTML attachment was scrubbed... URL: From Tim.Norman at dreamworks.com Mon Mar 21 17:05:57 2011 From: Tim.Norman at dreamworks.com (Norman, Tim) Date: Mon, 21 Mar 2011 09:05:57 -0700 Subject: [C++-sig] boost::python::set missing? In-Reply-To: <4D71125C.7040609@seefeld.name> References: <4D6D6FBE.6000608@wiggy.net> <4D6D7B90.5090709@seefeld.name> <891859.24839.qm@web111403.mail.gq1.yahoo.com> <4D70A708.1040604@wiggy.net> <540359.26233.qm@web111404.mail.gq1.yahoo.com> <4D71125C.7040609@seefeld.name> Message-ID: <57E24B0263A3594EB66EEABC419CA40742AB4A7EA7@EXCLUSGLD1.win.dreamworks.com> Hello, all. Dreamworks Animation is looking for Production/Pipeline Engineers to help build our production software. If you are a Python and/or C++ Developer interested in working at either our Redwood City or Glendale campus, send your resume to: tim.norman at dreamworks.com. Thanks Tim- Tim Norman Dreamworks Animation Ph 818.695 7801 www.dreamworks.com From stefan at seefeld.name Wed Mar 23 15:49:03 2011 From: stefan at seefeld.name (Stefan Seefeld) Date: Wed, 23 Mar 2011 10:49:03 -0400 Subject: [C++-sig] GSoC 2011 proposal for improved NumPy wrapper ? Message-ID: <4D8A085F.7090700@seefeld.name> Hello, As you may have heard, Boost has once again been accepted as a mentoring organization in this year's Google Summer of Code program. One of the potential projects that we have been talking about in the past is about improving the NumPy wrapper in Boost.Python. We talked about different shortcomings with the existing "numeric" module, and why a richer API to access NumPy would be useful. Some code to address these shortcomings already exists, and may be used as a starting point for such Boost.Python improvements. Anyone considering to work on this, please get in touch ! Stefan -- ...ich hab' noch einen Koffer in Berlin... From talljimbo at gmail.com Wed Mar 23 20:19:58 2011 From: talljimbo at gmail.com (Jim Bosch) Date: Wed, 23 Mar 2011 12:19:58 -0700 Subject: [C++-sig] GSoC 2011 proposal for improved NumPy wrapper ? In-Reply-To: <4D8A085F.7090700@seefeld.name> References: <4D8A085F.7090700@seefeld.name> Message-ID: <4D8A47DE.2050207@gmail.com> On 03/23/2011 07:49 AM, Stefan Seefeld wrote: > Hello, > > As you may have heard, Boost has once again been accepted as a mentoring > organization in this year's Google Summer of Code program. One of the > potential projects that we have been talking about in the past is about > improving the NumPy wrapper in Boost.Python. > We talked about different shortcomings with the existing "numeric" > module, and why a richer API to access NumPy would be useful. > > Some code to address these shortcomings already exists, and may be used > as a starting point for such Boost.Python improvements. > > Anyone considering to work on this, please get in touch ! I would definitely like to be involved in this, and I can provide a lot of that "existing code". I'm not sure I can sign up as a full mentor at this point - I have a PhD thesis to write this summer that needs to take priority - but I'd certainly like to help. Jim Bosch From praveen97uma at gmail.com Wed Mar 23 21:20:04 2011 From: praveen97uma at gmail.com (Praveen Kumar) Date: Thu, 24 Mar 2011 01:50:04 +0530 Subject: [C++-sig] GSoC 2011 proposal for improved NumPy wrapper ? In-Reply-To: <4D8A47DE.2050207@gmail.com> References: <4D8A085F.7090700@seefeld.name> <4D8A47DE.2050207@gmail.com> Message-ID: Hi ! I am Praveen Kumar pursuing Integrated M.Sc in Applied Mathematics at IIT Roorkee, India. One the very first day when the list of selected organisations was released, I wanted to work on this project on improving the NumPy wrapper in Boost.Python. I even read the discussions on the mailing lists regarding increasing the limited support of numpy.ndarray. Stefan was talking something about the need of raw pointers and limited support because of no support of multi-dimensional arrays in C++. My knowledge of STL is 3/5 and I am good at python. I have never used smart pointers because I never felt the need of it. I use version control systems but not subversion. Since, It is my first time at GSoC, I was a bit hesitant to drop my willingness to code for this project in the mailing list. On Thu, Mar 24, 2011 at 12:49 AM, Jim Bosch wrote: > On 03/23/2011 07:49 AM, Stefan Seefeld wrote: > >> Hello, >> >> As you may have heard, Boost has once again been accepted as a mentoring >> organization in this year's Google Summer of Code program. One of the >> potential projects that we have been talking about in the past is about >> improving the NumPy wrapper in Boost.Python. >> We talked about different shortcomings with the existing "numeric" >> module, and why a richer API to access NumPy would be useful. >> >> Some code to address these shortcomings already exists, and may be used >> as a starting point for such Boost.Python improvements. >> >> Anyone considering to work on this, please get in touch ! >> > > I would definitely like to be involved in this, and I can provide a lot of > that "existing code". I'm not sure I can sign up as a full mentor at this > point - I have a PhD thesis to write this summer that needs to take priority > - but I'd certainly like to help. > > Jim Bosch > > _______________________________________________ > Cplusplus-sig mailing list > Cplusplus-sig at python.org > http://mail.python.org/mailman/listinfo/cplusplus-sig > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andyspiros at gmail.com Wed Mar 23 23:39:16 2011 From: andyspiros at gmail.com (Andrea Arteaga) Date: Wed, 23 Mar 2011 23:39:16 +0100 Subject: [C++-sig] GSoC 2011 proposal for improved NumPy wrapper ? In-Reply-To: References: <4D8A085F.7090700@seefeld.name> <4D8A47DE.2050207@gmail.com> Message-ID: As I said some time ago, I'm very interested on this topic. I'm a fan of Boost, I already used Boost.Python and I'm a Numpy user. But I never had a look at the code behind Boost.Python, nor at the functions of the Numpy support. Alas, I cannot find any resources about this but the code itself. And lastly, I probably will be involved in another (similar) project for this GSoC. I really hope that somebody will apply for this project; I will stay tuned, because I'm really interested on this. If nobody comes and I am actually eliged for the other project, I could propose myself as helper-developer (starting from next September...) for this set of features. I would be really proud to join the Boost team! Andrea Arteaga On Thu, Mar 24, 2011 at 12:49 AM, Jim Bosch wrote: > On 03/23/2011 07:49 AM, Stefan Seefeld wrote: > >> > Hello, >> >>> >> As you may have heard, Boost has once again been accepted as a mentoring >> >>> organization in this year's Google Summer of Code program. One of the >> >>> potential projects that we have been talking about in the past is about >> >>> improving the NumPy wrapper in Boost.Python. >> >>> We talked about different shortcomings with the existing "numeric" >> >>> module, and why a richer API to access NumPy would be useful. >> >>> >> Some code to address these shortcomings already exists, and may be used >> >>> as a starting point for such Boost.Python improvements. >> >>> >> Anyone considering to work on this, please get in touch ! >> > I would definitely like to be involved in this, and I can provide a lot of > that "existing code". I'm not sure I can sign up as a full mentor at this > point - I have a PhD thesis to write this summer that needs to take priority > - but I'd certainly like to help. > > Jim Bosch > >> >> _______________________________________________ >> Cplusplus-sig mailing list >> Cplusplus-sig at python.org >> http://mail.python.org/mailman/listinfo/cplusplus-sig >> > > > _______________________________________________ > Cplusplus-sig mailing list > Cplusplus-sig at python.org > http://mail.python.org/mailman/listinfo/cplusplus-sig > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ndbecker2 at gmail.com Thu Mar 24 14:31:58 2011 From: ndbecker2 at gmail.com (Neal Becker) Date: Thu, 24 Mar 2011 09:31:58 -0400 Subject: [C++-sig] GSoC 2011 proposal for improved NumPy wrapper ? References: <4D8A085F.7090700@seefeld.name> <4D8A47DE.2050207@gmail.com> Message-ID: Jim Bosch wrote: > On 03/23/2011 07:49 AM, Stefan Seefeld wrote: >> Hello, >> >> As you may have heard, Boost has once again been accepted as a mentoring >> organization in this year's Google Summer of Code program. One of the >> potential projects that we have been talking about in the past is about >> improving the NumPy wrapper in Boost.Python. >> We talked about different shortcomings with the existing "numeric" >> module, and why a richer API to access NumPy would be useful. >> >> Some code to address these shortcomings already exists, and may be used >> as a starting point for such Boost.Python improvements. >> >> Anyone considering to work on this, please get in touch ! > > I would definitely like to be involved in this, and I can provide a lot > of that "existing code". I'm not sure I can sign up as a full mentor at > this point - I have a PhD thesis to write this summer that needs to take > priority - but I'd certainly like to help. > > Jim Bosch I am very interested in Jim's code, which I've just started using. Previously, I have used pyublas extensively and found it very capable. But Jim's ndarray code adds a lot of functionality. While I appreciate others wanting to get involved, this is a battle that has dragged on for years. I doubt that even a brilliant newcomer can create something even approaching pyublas or ndarray in one summer. I only have 3 concerns regarding ndarray at present: 1) documentation is thin 2) not sure about efficiency of various usage patterns 3) not sure about future support On a side note, I'm wondering if the new iterator in numpy-1.6 will be helpful. From stefan at seefeld.name Thu Mar 24 14:50:11 2011 From: stefan at seefeld.name (Stefan Seefeld) Date: Thu, 24 Mar 2011 09:50:11 -0400 Subject: [C++-sig] GSoC 2011 proposal for improved NumPy wrapper ? In-Reply-To: References: <4D8A085F.7090700@seefeld.name> <4D8A47DE.2050207@gmail.com> Message-ID: <4D8B4C13.106@seefeld.name> On 2011-03-24 09:31, Neal Becker wrote: > Jim Bosch wrote: > >> On 03/23/2011 07:49 AM, Stefan Seefeld wrote: >>> Anyone considering to work on this, please get in touch ! >> I would definitely like to be involved in this, and I can provide a lot >> of that "existing code". I'm not sure I can sign up as a full mentor at >> this point - I have a PhD thesis to write this summer that needs to take >> priority - but I'd certainly like to help. >> >> Jim Bosch > I am very interested in Jim's code, which I've just started using. Previously, > I have used pyublas extensively and found it very capable. But Jim's ndarray > code adds a lot of functionality. Great. > While I appreciate others wanting to get involved, this is a battle that has > dragged on for years. I doubt that even a brilliant newcomer can create > something even approaching pyublas or ndarray in one summer. Neal, I wouldn't characterize it as a battle. While there are a couple of points which not everyone may agree with, I think overall the issue was merely that no-one has taken the time and effort to clean things up enough to be able to formally move it into boost trunk. To get out of this impasse I don't think the solution is to start over. Rather, it is to work together with everyone who has something to contribute, build consensus (if required) on at least the most fundamental points, and then get closer to a new boost submission. (OK, I'm fully aware of the difficulties in the non-technical aspects of this, so I think we need to carefully phrase the proposal such that it has a chance to succeed even if at the end it will still be a proposal, not an accepted new boost component.) In other words, I expect the project to start with the existing code ( https://svn.boost.org/svn/boost/sandbox/numpy/, I think that is, yes ?) and improve that in various ways. Do you not thing this is a sensible approach ? Thanks, Stefan -- ...ich hab' noch einen Koffer in Berlin... From praveen97uma at gmail.com Thu Mar 24 17:47:16 2011 From: praveen97uma at gmail.com (Praveen Kumar) Date: Thu, 24 Mar 2011 22:17:16 +0530 Subject: [C++-sig] GSoC 2011 proposal for improved NumPy wrapper ? In-Reply-To: <4D8B4C13.106@seefeld.name> References: <4D8A085F.7090700@seefeld.name> <4D8A47DE.2050207@gmail.com> <4D8B4C13.106@seefeld.name> Message-ID: Thanks Stefan ! I would enjoy working with your support and I will be needing your help in preparing the proposal. Meanwhile, I shall go through the code. Cheers, Praveen On Thu, Mar 24, 2011 at 7:20 PM, Stefan Seefeld wrote: > On 2011-03-24 09:31, Neal Becker wrote: > >> Jim Bosch wrote: >> >> On 03/23/2011 07:49 AM, Stefan Seefeld wrote: >>> >>>> Anyone considering to work on this, please get in touch ! >>>> >>> I would definitely like to be involved in this, and I can provide a lot >>> of that "existing code". I'm not sure I can sign up as a full mentor at >>> this point - I have a PhD thesis to write this summer that needs to take >>> priority - but I'd certainly like to help. >>> >>> Jim Bosch >>> >> I am very interested in Jim's code, which I've just started using. >> Previously, >> I have used pyublas extensively and found it very capable. But Jim's >> ndarray >> code adds a lot of functionality. >> > > Great. > > > While I appreciate others wanting to get involved, this is a battle that >> has >> dragged on for years. I doubt that even a brilliant newcomer can create >> something even approaching pyublas or ndarray in one summer. >> > > Neal, > > I wouldn't characterize it as a battle. While there are a couple of points > which not everyone may agree with, I think overall the issue was merely that > no-one has taken the time and effort to clean things up enough to be able to > formally move it into boost trunk. > > To get out of this impasse I don't think the solution is to start over. > Rather, it is to work together with everyone who has something to > contribute, build consensus (if required) on at least the most fundamental > points, and then get closer to a new boost submission. > > (OK, I'm fully aware of the difficulties in the non-technical aspects of > this, so I think we need to carefully phrase the proposal such that it has a > chance to succeed even if at the end it will still be a proposal, not an > accepted new boost component.) > > In other words, I expect the project to start with the existing code ( > https://svn.boost.org/svn/boost/sandbox/numpy/, I think that is, yes ?) > and improve that in various ways. > > Do you not thing this is a sensible approach ? > > Thanks, > > Stefan > > -- > > ...ich hab' noch einen Koffer in Berlin... > > _______________________________________________ > Cplusplus-sig mailing list > Cplusplus-sig at python.org > http://mail.python.org/mailman/listinfo/cplusplus-sig > -------------- next part -------------- An HTML attachment was scrubbed... URL: From talljimbo at gmail.com Thu Mar 24 21:14:14 2011 From: talljimbo at gmail.com (Jim Bosch) Date: Thu, 24 Mar 2011 13:14:14 -0700 Subject: [C++-sig] GSoC 2011 proposal for improved NumPy wrapper ? In-Reply-To: References: <4D8A085F.7090700@seefeld.name> <4D8A47DE.2050207@gmail.com> Message-ID: <4D8BA616.1020000@gmail.com> On 03/24/2011 06:31 AM, Neal Becker wrote: > Jim Bosch wrote: > >> On 03/23/2011 07:49 AM, Stefan Seefeld wrote: >>> Hello, >>> >>> As you may have heard, Boost has once again been accepted as a mentoring >>> organization in this year's Google Summer of Code program. One of the >>> potential projects that we have been talking about in the past is about >>> improving the NumPy wrapper in Boost.Python. >>> We talked about different shortcomings with the existing "numeric" >>> module, and why a richer API to access NumPy would be useful. >>> >>> Some code to address these shortcomings already exists, and may be used >>> as a starting point for such Boost.Python improvements. >>> >>> Anyone considering to work on this, please get in touch ! >> >> I would definitely like to be involved in this, and I can provide a lot >> of that "existing code". I'm not sure I can sign up as a full mentor at >> this point - I have a PhD thesis to write this summer that needs to take >> priority - but I'd certainly like to help. >> >> Jim Bosch > > I am very interested in Jim's code, which I've just started using. Previously, > I have used pyublas extensively and found it very capable. But Jim's ndarray > code adds a lot of functionality. > > While I appreciate others wanting to get involved, this is a battle that has > dragged on for years. I doubt that even a brilliant newcomer can create > something even approaching pyublas or ndarray in one summer. > > I only have 3 concerns regarding ndarray at present: > 1) documentation is thin > 2) not sure about efficiency of various usage patterns > 3) not sure about future support > > On a side note, I'm wondering if the new iterator in numpy-1.6 will be helpful. Neil, I certainly appreciate (and agree with) the viewpoint that all of this can't be done in one summer by a relative newcomer. But I think we can put together reasonable GSoC project by limiting our attention to cleaning up and completing the boost/python/numpy code, rather than deal with the entire ndarray package (I think this is what Stefan had in mind, anyhow). If we can get that in a state where it can be added to Boost.Python (even if it's an optional build target), ndarray can simply be upgraded to make use of that rather than what's in the boost sandbox. And hopefully other projects that don't want to use ndarray (like pyublas) will can use boost/python/numpy at a lower level as well. If we start with boost/python/numpy, I think the most important tasks are: - Add "object manager" classes for additional numpy types ("object managers" are Boost.Python versions of Python types; right now boost/python/numpy only supports the most important numpy types, like numpy.ndarray and numpy.dtype). Most of these will be trivial, but there may be a lot of them. We want complete coverage of the numpy C-API. - Add additional methods to the numpy.ndarray object manager (numpy.ndarray has a ton of methods in Python; I'm not sure all of them need to be supported from C++ if we can do attr("method")()) - Fix conversions between numpy scalar types and C++ POD types (other projects mentioned on this list have solved this at some level). - Review and possibly revise the array-from-data API (i.e. how should the user pass in shape and strides?) - Review and possibly revise how the numpy C-API and its ugly preprocessor macros are hidden. - Add documentation. - Integrate into the boost build system. Jim From j.reid at mail.cryst.bbk.ac.uk Fri Mar 25 10:22:12 2011 From: j.reid at mail.cryst.bbk.ac.uk (John Reid) Date: Fri, 25 Mar 2011 09:22:12 +0000 Subject: [C++-sig] GSoC 2011 proposal for improved NumPy wrapper ? In-Reply-To: <4D8BA616.1020000@gmail.com> References: <4D8A085F.7090700@seefeld.name> <4D8A47DE.2050207@gmail.com> <4D8BA616.1020000@gmail.com> Message-ID: On 24/03/11 20:14, Jim Bosch wrote: > If we start with boost/python/numpy, I think the most important tasks are: > - Add "object manager" classes for additional numpy types ("object > managers" are Boost.Python versions of Python types; right now > boost/python/numpy only supports the most important numpy types, like > numpy.ndarray and numpy.dtype). Most of these will be trivial, but there > may be a lot of them. We want complete coverage of the numpy C-API. > - Add additional methods to the numpy.ndarray object manager > (numpy.ndarray has a ton of methods in Python; I'm not sure all of them > need to be supported from C++ if we can do attr("method")()) > - Fix conversions between numpy scalar types and C++ POD types (other > projects mentioned on this list have solved this at some level). > - Review and possibly revise the array-from-data API (i.e. how should > the user pass in shape and strides?) > - Review and possibly revise how the numpy C-API and its ugly > preprocessor macros are hidden. > - Add documentation. > - Integrate into the boost build system. Is support planned for boost::multi_arrays? If not, can I add my +1? John. From ndbecker2 at gmail.com Fri Mar 25 11:55:41 2011 From: ndbecker2 at gmail.com (Neal Becker) Date: Fri, 25 Mar 2011 06:55:41 -0400 Subject: [C++-sig] GSoC 2011 proposal for improved NumPy wrapper ? References: <4D8A085F.7090700@seefeld.name> <4D8A47DE.2050207@gmail.com> <4D8BA616.1020000@gmail.com> Message-ID: John Reid wrote: > On 24/03/11 20:14, Jim Bosch wrote: >> If we start with boost/python/numpy, I think the most important tasks are: >> - Add "object manager" classes for additional numpy types ("object >> managers" are Boost.Python versions of Python types; right now >> boost/python/numpy only supports the most important numpy types, like >> numpy.ndarray and numpy.dtype). Most of these will be trivial, but there >> may be a lot of them. We want complete coverage of the numpy C-API. >> - Add additional methods to the numpy.ndarray object manager >> (numpy.ndarray has a ton of methods in Python; I'm not sure all of them >> need to be supported from C++ if we can do attr("method")()) >> - Fix conversions between numpy scalar types and C++ POD types (other >> projects mentioned on this list have solved this at some level). >> - Review and possibly revise the array-from-data API (i.e. how should >> the user pass in shape and strides?) >> - Review and possibly revise how the numpy C-API and its ugly >> preprocessor macros are hidden. >> - Add documentation. >> - Integrate into the boost build system. > > Is support planned for boost::multi_arrays? If not, can I add my +1? > > John. If we're considering support for various c++ libs, ones to consider might include: eigen boost::multi_array boost::ublas nt2? From stefan at seefeld.name Fri Mar 25 12:12:26 2011 From: stefan at seefeld.name (Stefan Seefeld) Date: Fri, 25 Mar 2011 07:12:26 -0400 Subject: [C++-sig] GSoC 2011 proposal for improved NumPy wrapper ? In-Reply-To: References: <4D8A085F.7090700@seefeld.name> <4D8A47DE.2050207@gmail.com> <4D8BA616.1020000@gmail.com> Message-ID: <4D8C789A.6090209@seefeld.name> On 2011-03-25 06:55, Neal Becker wrote: > John Reid wrote: > >> >> Is support planned for boost::multi_arrays? If not, can I add my +1? >> >> John. > If we're considering support for various c++ libs, ones to consider might > include: > > eigen > boost::multi_array > boost::ublas > nt2? The other day we seemed to agree that the project is already rather large, for a small 3 months of GSoC. Let's not add more and more feature requests to it. I'd like to focus on NumPy. Additional things may be added once the first steps are done. Stefan -- ...ich hab' noch einen Koffer in Berlin... From macieksitarz at wp.pl Fri Mar 25 12:59:47 2011 From: macieksitarz at wp.pl (Maciej Sitarz) Date: Fri, 25 Mar 2011 12:59:47 +0100 Subject: [C++-sig] language-binding.net website not available Message-ID: <4D8C83B3.6080801@wp.pl> Hi since some time the Py++ project's homepage is down. Does anyone know why? Was it moved somewhere or there's some mirror available? I also haven't seen Roman Yakovenko posting here recently. Thanks for any info. Regards -- Maciek Sitarz From roman.yakovenko at gmail.com Fri Mar 25 17:21:20 2011 From: roman.yakovenko at gmail.com (Roman Yakovenko) Date: Fri, 25 Mar 2011 18:21:20 +0200 Subject: [C++-sig] language-binding.net website not available In-Reply-To: <4D8C83B3.6080801@wp.pl> References: <4D8C83B3.6080801@wp.pl> Message-ID: On Fri, Mar 25, 2011 at 1:59 PM, Maciej Sitarz wrote: > Hi > Hello. > since some time the Py++ project's homepage is down. Does anyone know why? Yes. I do not have time to maintain it. > Was it moved somewhere or there's some mirror available? > You can find everything you need on http://sourceforge.net/projects/pygccxml/ page - documentation, bug tracking, mailing list, source and etc. > I also haven't seen Roman Yakovenko posting here recently. > There were 0 posts related to py++ :-). The project is alive and only recently I fixed few bugs. -------------- next part -------------- An HTML attachment was scrubbed... URL: From talljimbo at gmail.com Fri Mar 25 19:34:50 2011 From: talljimbo at gmail.com (Jim Bosch) Date: Fri, 25 Mar 2011 11:34:50 -0700 Subject: [C++-sig] GSoC 2011 proposal for improved NumPy wrapper ? In-Reply-To: <4D8C789A.6090209@seefeld.name> References: <4D8A085F.7090700@seefeld.name> <4D8A47DE.2050207@gmail.com> <4D8BA616.1020000@gmail.com> <4D8C789A.6090209@seefeld.name> Message-ID: <4D8CE04A.50006@gmail.com> On 03/25/2011 04:12 AM, Stefan Seefeld wrote: > On 2011-03-25 06:55, Neal Becker wrote: >> John Reid wrote: >> >>> >>> Is support planned for boost::multi_arrays? If not, can I add my +1? >>> >>> John. >> If we're considering support for various c++ libs, ones to consider might >> include: >> >> eigen >> boost::multi_array >> boost::ublas >> nt2? > > > The other day we seemed to agree that the project is already rather > large, for a small 3 months of GSoC. Let's not add more and more feature > requests to it. I'd like to focus on NumPy. Additional things may be > added once the first steps are done. I agree. I think the focus should be on a Boost.Python interface to the Numpy C-API that can be used to simplify numpy converters for the various C++ template linear algebra libraries available, rather than provide Boost.Python support for any of those libraries specifically (yet). Jim From archapm at fas.harvard.edu Wed Mar 30 14:56:17 2011 From: archapm at fas.harvard.edu (Alec Chapman) Date: Wed, 30 Mar 2011 08:56:17 -0400 Subject: [C++-sig] segfault wrapping iterator_facade input iterators Message-ID: <1301489777.4d9328712e8f6@webmail.fas.harvard.edu> Hi all, I'm having some trouble using boost.python to expose an input iterator that I've implemented using boost::iterator_facade. I've included an example below. The code will print garbage when iterating in python and segfault for more complicated iterators, but works fine if std::input_iterator_tag is changed to forward_iterator_tag. I've noticed this happens in VC9 and gcc. The problem goes away if line 65 in boost/python/object/iterator.hpp is changed from "return *self.m_start++;" to something like: result_type r = *self.m_start; ++self.m_start; return r; It seems that this change should be made for input iterators, since the postfix increment operator is allowed to return void. However, I don't fully understand why this is a problem in my case since iterator_facade returns a proxy iterator that can be dereferenced. Thanks for any help, Alec #include #include using namespace boost::python; class container { public: class iter : public boost::iterator_facade { public: iter(int* i) : m_i(i) {} private: friend class boost::iterator_core_access; void increment() { m_i++; } int& dereference() const { return *m_i; } bool equal(const iter& other) const { return m_i == other.m_i; } int* m_i; }; container() : m_data() {} iter begin() { return iter(m_data); } iter end() { return iter(m_data+5); } private: int m_data[5]; }; BOOST_PYTHON_MODULE(iter_example) { class_("container") .add_property("data", range(&container::begin, &container::end)) ; } ------------------------------------------ import iter_example c = iter_example.container() for x in c.data: print x From ankitdaf at gmail.com Thu Mar 31 05:01:20 2011 From: ankitdaf at gmail.com (Ankit Daftery) Date: Thu, 31 Mar 2011 08:31:20 +0530 Subject: [C++-sig] GSoC Boost.Python project In-Reply-To: <4D939DBC.7030906@seefeld.name> References: <4D8C8165.30307@seefeld.name> <4D8DDD79.7040905@seefeld.name> <4D939DBC.7030906@seefeld.name> Message-ID: Hello I am working on the project proposal for GSoC 2011 for the Boost.python project, and I would like a little help. 1. ndarray.hpp mentions that functionality needs to be added like the one in boost::python::numeric::array . Stefan suggested that Jim might be able to help with what exactly was intended. Is there anything specific in mind ? 2. Neal mentions that efficiency needs to be improved. Could you please help me with a little more detail about that, Neal ? 3. ndarray.hpp also mentions that the templates "Should probably take ranges of iterators rather than actual container objects." Could someone explain what is intended ? Am I missing out on something essential ? Anything I should keep in mind ? Tips and pointers. Please help me out here. Thanks, Ankit -------------- next part -------------- An HTML attachment was scrubbed... URL: From talljimbo at gmail.com Thu Mar 31 05:14:49 2011 From: talljimbo at gmail.com (Jim Bosch) Date: Wed, 30 Mar 2011 20:14:49 -0700 Subject: [C++-sig] GSoC Boost.Python project In-Reply-To: References: <4D8C8165.30307@seefeld.name> <4D8DDD79.7040905@seefeld.name> <4D939DBC.7030906@seefeld.name> Message-ID: <4D93F1A9.8060204@gmail.com> On 03/30/2011 08:01 PM, Ankit Daftery wrote: > Hello > > I am working on the project proposal for GSoC 2011 for the Boost.python > project, and I would like a little help. > > 1. ndarray.hpp mentions that functionality needs to be added like the > one in boost::python::numeric::array . Stefan suggested that Jim might > be able to help with what exactly was intended. Is there anything > specific in mind ? If one looks at the Numpy C-API or the list of methods available to numpy.ndarray, there are a lot more than are present in the wrapper in ndarray.hpp. Some of these should be added to ndarray.hpp. > > 2. Neal mentions that efficiency needs to be improved. Could you please > help me with a little more detail about that, Neal ? > > 3. ndarray.hpp also mentions that the templates "Should probably take > ranges of iterators rather than actual container objects." Could someone > explain what is intended ? > This is just a question of how best to pass a sequence of integers that specify the shape and stride of array. Making the argument a specific C++ container type requires the user to use exactly that type and to fill it with exactly those elements; it's usually considered better form to accept a range of iterators when you can. Taking iterator ranges makes for a lot of arguments, though, which makes the API a little unwieldy, especially considering the size of the containers has to be the same. I think one of the goals for the GSoC project would be to look at different ways to rework that API and see what various people like best. > Am I missing out on something essential ? Anything I should keep in mind > ? Tips and pointers. In one of my previous emails on this list I wrote down what my goals would be for this project (including the two discussed above). In general, I think it's about taking the sandbox library and cleaning it up to the point where it's at a boost level of quality, and possibly revisiting some of the design decisions that went into it. Jim From ndbecker2 at gmail.com Thu Mar 31 14:45:06 2011 From: ndbecker2 at gmail.com (Neal Becker) Date: Thu, 31 Mar 2011 08:45:06 -0400 Subject: [C++-sig] GSoC Boost.Python project References: <4D8C8165.30307@seefeld.name> <4D8DDD79.7040905@seefeld.name> <4D939DBC.7030906@seefeld.name> Message-ID: Ankit Daftery wrote: > Hello > > I am working on the project proposal for GSoC 2011 for the Boost.python > project, and I would like a little help. > > 1. ndarray.hpp mentions that functionality needs to be added like the one > in boost::python::numeric::array . Stefan suggested that Jim might be able > to help with what exactly was intended. Is there anything specific in mind ? > > 2. Neal mentions that efficiency needs to be improved. Could you please help > me with a little more detail about that, Neal ? I'm not saying it needs to be improved, but it needs to be investigated. The efficiency I'm concerned with is element access. I think there are 2 primary methods of element access: 1) iterator access 2) indexed access. The efficiency of each should be investigated, and opportunities for needed optimizations considered. > > 3. ndarray.hpp also mentions that the templates "Should probably take ranges > of iterators rather than actual container objects." Could someone explain > what is intended ? > > Am I missing out on something essential ? Anything I should keep in mind ? > Tips and pointers. > > Please help me out here. > > Thanks, > Ankit