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.
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
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
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
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") =
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
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<>())
>>
>
&
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
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
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
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
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?
>>
&
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
Александров Петр 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
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?
__
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.
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
Will std::shared_ptr just work also?
___
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig
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
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
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
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
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
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
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
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
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
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
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
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
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)
>
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")
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
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.
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.
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
Do you intend to include some examples?
___
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig
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
>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.
>
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
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 {
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"
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
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
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
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
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
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.
_
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
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
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
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/
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?
__
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
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
http://wiki.python.org/moin/PortingExtensionModulesToPy3k
___
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig
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
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
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
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
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
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
62 matches
Mail list logo