Re: [C++-sig] Building Boost Python Tutorial Linker Errors

2016-03-23 Thread Neal Becker
I built boost-python on anaconda on linux using: https://anaconda.org/meznom/boost-python Joey Ortiz wrote: > Hello, > > I have spent the past week trying to build the boost python tutorial, only > to be stopped by numerous linker errors. > > I have posted my question on > http://stackoverflow.

Re: [C++-sig] pybind11 -- alternative to Boost.Python

2015-10-20 Thread Neal Becker
I noticed you used -flto when building the shared libs. Do you find this makes a difference? ___ Cplusplus-sig mailing list Cplusplus-sig@python.org https://mail.python.org/mailman/listinfo/cplusplus-sig

[C++-sig] np.int64 does not match unsigned long on py3?

2014-05-29 Thread Neal Becker
Using boost::python, it seems a python arg of type np.int64 will match a call requiring c++ type size_t on python2, but on python3 I get: burst.pilot_xsyms = gold_code_generator (-1, -1) (burst.n_pilot_syms) Boost.Python.ArgumentError: Python argument types in gold_code_generator.__call__(g

Re: [C++-sig] Boost::Python Reference Counting

2014-05-20 Thread Neal Becker
laan wrote: > Hi, > > I'm having issues with Boost::Python objects that contain a reference to a > c++ object: > > --- C++ code > > #include > > struct Container; > > struct Element > { > Element(const Container * c) : _container(c) { } > std::string name() const; > const Co

Re: [C++-sig] create a python object from scratch in boost.python?

2014-01-20 Thread Neal Becker
Gary Oberbrunner wrote: > I'd like to create a python object with some attributes in C++, and return it > to python. Something like this: > > Plugin_Info *pinfo = get_plugin_info_i(i); > bp::object plugin; // this creates None; how can I make an empty class? > plugin.attr("name") =

Re: [C++-sig] numpy integration with boost.python

2013-12-05 Thread Neal Becker
hero...@gmail.com wrote: > Dear all, > > This is a cross post of stackoverflow[0]. > ... > I searched the web for a solution. The candidates are: > > 1. Cython[5] with memoryview[6] > 2. pyublas[7] > 3. Boost.NumPy[8] > ... I've been using ndarray lately: https://github.com/ndarray/ndarray

Re: [C++-sig] memory leak with __iadd__

2013-09-26 Thread Neal Becker
Nikolay Mladenov wrote: > On Wed, Sep 25, 2013 at 11:22 AM, Neal Becker wrote: > >> I've been trying to track down a memory leak. When I use the following: >> >> .def ("__iadd__", &hist_t::operator+=, bp::return_self<>()) >> > &

[C++-sig] memory leak with __iadd__

2013-09-25 Thread Neal Becker
I've been trying to track down a memory leak. When I use the following: .def ("__iadd__", &hist_t::operator+=, bp::return_self<>()) I have a leak. When changed to: .def (bp::self += hist_t::value_type()) there is no leak. Any ideas? I suppose I maybe should just start using the latter st

Re: [C++-sig] double free segfaults

2013-09-01 Thread Neal Becker
Ellery Newcomer wrote: > Hello all. > > I have been trying to wrap a third party C++ library with boost::python > (first time using boost::python!), and on a very simple example I seem to > be getting double free segfaults, so I am here soliciting advice. Does > anything stand out? > > In gdb, I

[C++-sig] return boost::shared_ptr

2013-06-14 Thread Neal Becker
I have a class that has a member something like this: class A { boost::shared_ptr b; }; boost::shared_ptr get_b (A const& ...) { return A.b; } where class B is already exposed to python in a different module. I tried to provide access to the internal member A.b: class_ ... .add_proper

Re: [C++-sig] CallPolicy for operators

2013-03-15 Thread Neal Becker
Jim Bosch wrote: > On 01/27/2013 05:02 AM, Michael Wild wrote: >> Hi all >> >> Is there a way to apply a CallPolicy to operator definitions? In >> particular, I'm interested in the inplace operators (+=, -=, *=, /= and >> friends). >> >> To give a bit more context: The library I'm trying to wrap e

Re: [C++-sig] checking passed arg is python type

2013-03-14 Thread Neal Becker
Jim Bosch wrote: > On 03/14/2013 06:12 PM, Neal Becker wrote: >> I'm expecting a numpy.random.RandomState object to be passed to me. I want >> to >> check it is. The best I could think of is below. Anything more >> boost::python- ish to do this task? >> &

[C++-sig] checking passed arg is python type

2013-03-14 Thread Neal Becker
I'm expecting a numpy.random.RandomState object to be passed to me. I want to check it is. The best I could think of is below. Anything more boost::python- ish to do this task? static object rs_obj; template struct engine { typedef out_type result_type; bp::object rs;// Ra

Re: [C++-sig] [Boost.Python] Adding a constructor to python object

2013-03-05 Thread Neal Becker
Александров Петр wrote: > I want to create a Python interface for > "boost::numeric::ublas::vector" Not a direct answer to your question, but you might like pyUblas ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/l

Re: [C++-sig] Segmentation Fault with Boost.Python and Inheritance

2012-05-24 Thread Neal Becker
I believe I hit the same bug, using extract on a polymorphic type. In the old code, I used make_constructor, passing object to it, and using extract. In the new code, I don't use make_constructor, just use bp::init. My segfault is gone. Maybe just luck? __

Re: [C++-sig] Combining Boost Serialization with Boost Python

2012-03-15 Thread Neal Becker
I have used this myself for some time. Here is an example: typedef boost::mt19937 rng_t; struct mt_pickle_suite : bp::pickle_suite { static bp::object getstate (const rng_t& rng) { std::ostringstream os; boost::archive::binary_oarchive oa(os); oa << rng; return bp::str (os.

Re: [C++-sig] boost::python handles boost::shared_ptr specially...

2012-02-11 Thread Neal Becker
Jim Bosch wrote: > On 02/06/2012 11:33 AM, Neal Becker wrote: >> Will std::shared_ptr just work also? > > Just tried the experiment, albeit with slightly old versions. > > As of gcc 4.4 (with -std=gnu++0x) and Boost 1.47, it looks like > Boost.Python doesn't even

[C++-sig] boost::python handles boost::shared_ptr specially...

2012-02-06 Thread Neal Becker
Will std::shared_ptr just work also? ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig

[C++-sig] Solved (pickle multiple refs to objects)

2011-09-06 Thread Neal Becker
The solution to my problem is a combination of boost::serialization and boost::shared_ptr. Rather than holding refs to the contained shared objects, if the objects are share_ptr, then serialization will do the correct thing. For example, I have struct boost_uniform_int_wrap { boost::shared_p

[C++-sig] pickle the unpickleable

2011-09-03 Thread Neal Becker
I have a pickling problem I suspect is just not possible to solve. I have some wrappers around boost::random objects. There is a rng object, which is a single underlying mersenne twister. There are various distributions. For example, uniform_real. Each uniform_real holds a reference to the sin

Re: [C++-sig] New Major-Release Boost.Python Development

2011-08-26 Thread Neal Becker
The top of my list is improved interface to numpy. I know there is work going on in the form of ndarray, which seems promising. ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig

Re: [C++-sig] New Major-Release Boost.Python Development

2011-08-26 Thread Neal Becker
What sort of improvements did you have in mind? ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig

Re: [C++-sig] GSoC Boost.Python project

2011-03-31 Thread Neal Becker
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

Re: [C++-sig] GSoC 2011 proposal for improved NumPy wrapper ?

2011-03-25 Thread Neal Becker
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 su

Re: [C++-sig] GSoC 2011 proposal for improved NumPy wrapper ?

2011-03-24 Thread Neal Becker
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 ab

[C++-sig] Can't add attribute to function

2011-02-22 Thread Neal Becker
I can add attributes to instances of classes created by boost::python, but not to boost::python functions: limiter.delay = 0 AttributeError: 'Boost.Python.function' object has no attribute 'delay' Any ideas? ___ Cplusplus-sig mailing list Cplusplu

Re: [C++-sig] Status of Numpy support in boost python - II

2011-01-04 Thread Neal Becker
nt N = 1, int C = 1]’ boost.python/ndarray/libs/python/ndarray/test/ndarray_mod.cpp:125:66: instantiated from here include/ndarray/ExpressionTraits.hpp:88:165: internal compiler error: Segmentation fault Jim Bosch wrote: > On 01/03/2011 01:44 PM, Ralf W. Grosse-Kunstleve wrote: >> ----- Ori

[C++-sig] Status of Numpy support in boost python - II

2011-01-03 Thread Neal Becker
I was just re-reading these posts: Status of Numpy support in boost python http://web.archiveorange.com/archive/v/YJlerznoeRShLhlurQzC I wonder if there are any updates? Is ndarray working with current (1.45.0) boost? ___ Cplusplus-sig mailing list Cpl

[C++-sig] expose functor?

2010-12-14 Thread Neal Becker
Suppose I have a functor, e.g.: template struct mag_sqr1 { F operator() (F z) { return (z * z); } }; Any way to expose this a a python function? def ("mag_sqr", ???); ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.o

Re: [C++-sig] boost::python + python3.1.2 throw

2010-10-20 Thread Neal Becker
Neal Becker wrote: > Neal Becker wrote: > >> Has behavior of c++ exception changed with boost::python + python3? >> >> I used to simply use throw from c++. Now I get: >> SystemError: initialization of ldpc_45 raised unreported exception >> >> I belie

Re: [C++-sig] boost::python + python3.1.2 throw

2010-10-19 Thread Neal Becker
Neal Becker wrote: > Has behavior of c++ exception changed with boost::python + python3? > > I used to simply use throw from c++. Now I get: > SystemError: initialization of ldpc_45 raised unreported exception > > I believe this exception was really: > if (!fp) >

[C++-sig] boost::python + python3.1.2 throw

2010-10-19 Thread Neal Becker
Has behavior of c++ exception changed with boost::python + python3? I used to simply use throw from c++. Now I get: SystemError: initialization of ldpc_45 raised unreported exception I believe this exception was really: if (!fp) throw std::runtime_error ((boost::format ("fopen %1% failed")

Re: [C++-sig] Advice sought on making a large C++ application a Python extension

2010-09-15 Thread Neal Becker
Does pybindgen interoperate with numpy? That would be required for me to use it. Ben Fitzpatrick wrote: > David, > > I'm still a newbie on this list myself, but I will tell you that for the > larger project which we were attempting to wrap, we had excellent luck > with Gustavo Carniero's Pybin

Re: [C++-sig] Ownership of a C++ object extended in Python using wrapper

2010-03-17 Thread Neal Becker
One tradeoff, I believe, If you have, say: class A { A (boost::shared_ptr) boost::shared_ptr B_obj; }; Then each time you use B_obj, there is additional dereference overhead IIUC. If I used with_custodian_and_ward, there should not be this additional overhead.

Re: [C++-sig] Ownership of a C++ object extended in Python using wrapper

2010-03-17 Thread Neal Becker
Alexandre Hamez wrote: > > On 16 mars 2010, at 13:12, Neal Becker wrote: > >> Alexandre Hamez wrote: >> >>> Hi all, >>> >>> I have a C++ library that needs to store in a hash map user's code, that >>> is, Python-extended objects.

Re: [C++-sig] Ownership of a C++ object extended in Python using wrapper

2010-03-16 Thread Neal Becker
Alexandre Hamez wrote: > Hi all, > > I have a C++ library that needs to store in a hash map user's code, that > is, Python-extended objects. To make the C++ interface available to > Python, I use boost::python::wrapper, as stated in the tutorial > (http://www.boost.org/doc/libs/1_42_0/libs/pytho

Re: [C++-sig] Status of Numpy support in boost python

2010-03-09 Thread Neal Becker
Do you intend to include some examples? ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig

Re: [C++-sig] Status of Numpy support in boost python

2010-03-09 Thread Neal Becker
No luck with boost-1.42. fedora-12 boost-1.39 seems OK. Lots of errors, like: /usr/local/src/boost.hg/boost/fusion/container/vector/convert.hpp: In instantiation of 'boost::fusion::result_of::as_vector, 0>, boost::fusion::vector_iterator, -0x1> > >': include/ndarray/views.hpp

Re: [C++-sig] Status of Numpy support in boost python

2010-03-08 Thread Neal Becker
>Jim Bosch wrote: > On Mon, 2010-03-08 at 08:08 -0500, Stefan Seefeld wrote: >> On 03/08/2010 07:32 AM, Pim Schellart wrote: >> > Hello Everyone, >> > >> > we are working on a project for which it would be extremely useful if >> > numpy arrays could be passed as arguments to wrapped C++ methods. >

Re: [C++-sig] boost::python embedding return value

2010-03-04 Thread Neal Becker
Stefan Seefeld wrote: > Neal, > > I should have read your mail more carefully before replying. Sorry for > that. > > > On 03/04/2010 01:35 PM, Neal Becker wrote: >> Stefan Seefeld wrote: >> >> >>> On 03/04/2010 11:5

Re: [C++-sig] boost::python embedding return value

2010-03-04 Thread Neal Becker
Stefan Seefeld wrote: > On 03/04/2010 11:59 AM, Neal Becker wrote: >> int main () { >>Py_Initialize(); >> >>object main_module = import("__main__"); >>object main_namespace = main_module.attr("__dict__"); >> >>try {

[C++-sig] boost::python embedding return value

2010-03-04 Thread Neal Becker
int main () { Py_Initialize(); object main_module = import("__main__"); object main_namespace = main_module.attr("__dict__"); try { object result = exec ("import sys\n" "sys.path.append('./')\n" "import test_embed\n"

Re: [C++-sig] ANN: PyBindGen 0.14

2010-02-07 Thread Neal Becker
PyBindGen shows an example wrapping STL containers. What if I need to wrap my own containers? Is there some generic container machinery? ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig

[C++-sig] interrupting long running c++ code

2009-12-20 Thread Neal Becker
I don't suppose there's any way to allow interrupt signal through while a long-running boost::python wrapped function is running? It seems that python blocks the signal until the function completes. This is a single-threaded environment. ___ Cpluspl

Re: [C++-sig] Implementation of proper overload resolution

2009-12-20 Thread Neal Becker
When it's ready, I'd like to try it on my code collection (see that at least nothing breaks). ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig

Re: [C++-sig] Implementation of proper overload resolution

2009-12-18 Thread Neal Becker
I am concerned that this doesn't introduce too much overhead for the common case where there is no ambiguity. I suppose this has been optimized? ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-s

Re: [C++-sig] Implementation of proper overload resolution

2009-12-17 Thread Neal Becker
I assume overload resolution extends to scoring multiple arguments as well? ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig

Re: [C++-sig] boost::python overload resolution redux

2009-12-03 Thread Neal Becker
troy d. straszheim wrote: ... > > I've been thinking about this off and on for a while, to fix it right > isn't trivial. I could put in a few checks for cases where a function > is not overloaded, but that feels like hackery. > No ideas, but I appreciate you're looking into this. _

[C++-sig] functools.partial vs boost::python

2009-12-02 Thread Neal Becker
Has anyone noticed that a function created with boost::python using args() to give keyword arguments doesn't seem to work with functools.partial keyword arguments (but does with positional args)? For example, I have this function: class_ ("uniform_real", "Uniform float distribution", bp::i

Re: [C++-sig] Quick question about wrapping methods that have multiple versions

2009-09-09 Thread Neal Becker
Jean-Sébastien Guay wrote: > Hi Stefan, > >> This is not a wrapper function, but an alias. You create a new variable >> 'B_getA1', and make this point to B::getA (the non-const version). >> This works, since by means of the variable type you disambiguate, so >> using that in the call to def() wor

Re: [C++-sig] libboost_python-gcc43-mt.so or without "mt"?

2009-05-29 Thread Neal Becker
Werner Joergensen wrote: > > Dear list participants, > > I have installed boost including the python lib using the boostrap.sh > installation script, and now I have the following libraries under /lib > (linux system): libboost_python-gcc43-mt-1_39.a > libboost_python-gcc43-mt-1_39.so libboost_p

Re: [C++-sig] how to deep copy boost python object

2009-05-05 Thread Neal Becker
Gennadiy Rozental wrote: > This looks like trivial question from FAQ, but I can seem to fond the > answer. > > Any pointers? > > Genandiy Maybe overide __copy__? ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/

Re: [C++-sig] [JOB] C/C++/Linux Developers, NYC - Relo OK

2009-04-03 Thread Neal Becker
Beau Gould (OSS) wrote: > I'm recruiting C/C++/Linux Developers for a NYC client. Successful > candidates: ... > * do NOT have financial industry experience Wow, I've never seen _that_ before! What does it suggest?? Are those with financial experience tainted? __

Re: [C++-sig] Preliminary progress on Boost.Python py3k support

2009-04-02 Thread Neal Becker
In case you haven't seen it: http://docs.python.org/3.0/howto/cporting.html#cporting-howto ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig

Re: [C++-sig] can boost::python class imlement buffer protocol?

2009-01-16 Thread Neal Becker
Neal Becker wrote: > David Abrahams wrote: > >> >> on Wed Jan 07 2009, Neal Becker wrote: >> >>> This would require filling in tp_as_buffer field in the PyTypeObject >>> structure for the >>> class. Is this possible? Any clue how/where t

[C++-sig] Info on porting to python 3.0

2009-01-13 Thread Neal Becker
http://wiki.python.org/moin/PortingExtensionModulesToPy3k ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig

Re: [C++-sig] can boost::python class imlement buffer protocol?

2009-01-07 Thread Neal Becker
David Abrahams wrote: > > on Wed Jan 07 2009, Neal Becker wrote: > >> This would require filling in tp_as_buffer field in the PyTypeObject >> structure for the >> class. Is this possible? Any clue how/where this could be done? > > I honestly don't know

[C++-sig] can boost::python class imlement buffer protocol?

2009-01-07 Thread Neal Becker
This would require filling in tp_as_buffer field in the PyTypeObject structure for the class. Is this possible? Any clue how/where this could be done? ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplu

Re: [C++-sig] Wrap a c++ function that returns boost::shared_ptr<> type?

2008-12-18 Thread Neal Becker
I'm curious about 'return_range'. What does it do? Is there any doc? ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig

Re: [C++-sig] Wrap a c++ function that returns boost::shared_ptr<> type?

2008-12-18 Thread Neal Becker
Roman Yakovenko wrote: > 2008/12/18 lin yun : >> Actually I used return_range with element type of unsigned short. Python >> interprets the element as int. >> >> You mean it is not difficult to wrap a function that returns >> vector> then? > > Yes. Take a look on example: > http://language-bindin

Re: [C++-sig] problem w/intermodule communication

2008-11-25 Thread Neal Becker
William Ladwig wrote: > Neal, > > Try adding: > > register_ptr_to_python< boost::shared_ptr >(); > > to your BOOST_PYTHON_MODULE(test2) section. > > Hope this helps, > > Bill > Thanks! That's what it needed. ___ Cplusplus-sig mailing list Cplusp

[C++-sig] problem w/intermodule communication

2008-11-24 Thread Neal Becker
Here is a simple example. --- test1.cc #include #include #include #include using namespace boost::python; struct A { A (int _x) : x (_x) {} int x; }; BOOST_PYTHON_MODULE(test1) { class_ ("A", init()); } -- test2.cc #include #include #include #incl