[C++-sig] Crash at shutdown

2012-02-10 Thread Gennadiy Rozental
Hi, I need help with a crash I observe both on windows and Linux. I admit my use case is somewhat complicated, but that's reality. So, my problem consists form 3 components. Let's call them A, B, and C: A is Python *extension* library (dll/so). This is really just an infrastructure layer which he

[C++-sig] intercepting uncaught exceptions

2011-02-26 Thread Gennadiy Rozental
Hi, Is there any way to intercept uncaught exception in embedded Python code? I need to add some information to an exception/traceback in this case. I have full control over environment before embedded code is executed. I thought I'll be able to use sys.excepthook, but it does not seem to be in

[C++-sig] how to avoid documenting private methods

2010-03-19 Thread Gennadiy Rozental
I've got exported class A and I'd like to avoid reporting private methods when users type help (mymodule.A). Is there anything like __all__ for modules? naming these methods starting with _ does not help either. Please advise, Gennadiy ___ Cplusplus-si

Re: [C++-sig] boost.pyton scope bug?

2010-03-19 Thread Gennadiy Rozental
Jim Bosch gmail.com> writes: > > On Fri, 2010-03-19 at 19:55 +, Gennadiy Rozental wrote: > > I am doing something like this in export part of mymodule: > > > > scope S = class_("X", no_init ); > > > > class_( "Y",... )

[C++-sig] boost.pyton scope bug?

2010-03-19 Thread Gennadiy Rozental
I am doing something like this in export part of mymodule: scope S = class_("X", no_init ); class_( "Y",... ) ... ; In Python I do see mymodule.X.Y, but mymodule.X.Y.__name__ is 'mymodule.Y' Gennadiy ___ Cplusplus-sig mailing list Cplusplus-sig@pytho

[C++-sig] docstring for property?

2010-03-19 Thread Gennadiy Rozental
How do I provide doc string to the property like this: ... .add_property( "goo", make_function(...) ) While we are at it, how do I provide docstring and arg names to the operators: ... .def( self < self ) Gennadiy ___ Cplusplus-sig mailing lis

[C++-sig] errors while setting arguments description for the method

2010-03-17 Thread Gennadiy Rozental
I've got specification like this: class_( "Foo", "Foo descr" ) .def( "__init__", bp::make_constructor( &make_foo ), bp::args( "self", "str" ), "Constructor based on string representation.\n" ) ... I am getting compilation error below from VC9.0. Error disappears i

[C++-sig] export class constant

2009-12-10 Thread Gennadiy Rozental
Hi, Let's say I have string literal as static C++ class member: string Foo::abc = "ABC"; I'm exporting the class Foo. I'd like to export Foo::abc as well and be able to access it on Python side using similar interface: Foo.abc. Can I do this using Boost.Python? Gennadiy __

Re: [C++-sig] "pass all args in list" syntax

2009-10-09 Thread Gennadiy Rozental
Stefan Seefeld sympatico.ca> writes: > I added support for the above quite a while ago (and I'm assured that > this time it even made it into the release branch in time ). > Thus, you can construct a list and keyword, then pass to a python > callable as '*args' and '**kwds' respectively. Right

[C++-sig] "pass all args in list" syntax

2009-10-08 Thread Gennadiy Rozental
Hi, In native Python I can do something like this: def goo(a,b,c): return a+b+c ll = [1,2,3] goo( *ll ) And it will pass all the arguments properly. I need similar functionality in C++: Given bp::object func; bp::list args; I'd like to invoke the function like this fun

[C++-sig] Boost.Python module initialization failure

2009-07-27 Thread Gennadiy Rozental
What is the right way to report error from the Boost.Python extension module init function? Gennadiy ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig

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

2009-05-10 Thread Gennadiy Rozental
Ralf W. Grosse-Kunstleve yahoo.com> writes: > > > A comprehensive approach is to make the object picklable. > As a side-effect, copy.deepcopy() will also work. 1. Are you saying that copy.deepcopy does not work without object being picklable? What will happend if I try to use it for non pickla

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

2009-05-05 Thread Gennadiy Rozental
Neal Becker gmail.com> writes: > > Gennadiy Rozental wrote: > > > This looks like trivial question from FAQ, but I can seem to fond the > > answer. > > > > Any pointers? > > > > Genandiy > > Maybe overide __copy__? How is it involved?

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

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

[C++-sig] Exported class as mixin

2009-04-10 Thread Gennadiy Rozental
Hi, I've got exported class: class_( "MyInterface" ) ... And I've got class in Python: class ABC(object): ... I am doing some processing of the class definition in Python and want to be able to do the following (clazz here is ABC: clazz.__bases__ = (MyInterface,) + clazz.__bases__ I am

Re: [C++-sig] instantiate python classes in c++

2009-04-04 Thread Gennadiy Rozental
Gregor Burger uibk.ac.at> writes: > Maybe you can point me to the posts. I found you questions > but not theanswer including the solution.  The only solution I know is right below. >> The only viable solution I found is to *compile* the script first before >> executing it. If I do this globa

Re: [C++-sig] instantiate python classes in c++

2009-04-03 Thread Gennadiy Rozental
Gregor Burger uibk.ac.at> writes: > is it possible to use boost.python to define classes > in a script (like in the one below), register the defined > classes and later on create instances of the class? Yes > Is it possible to provide the same globals and locals to call_method > so that Flow a

Re: [C++-sig] using function objects as getters/setters for the properties

2009-02-10 Thread Gennadiy Rozental
David Abrahams boostpro.com> writes: > Frankly I'm not sure it's possible to use a function object in that way. > Have you tried simply using the data member pointer without the wrapper? > > bp::class_< MyClass >( "MyClass", bp::no_init ) > .add_property( "field", &MyClass::field )

[C++-sig] using function objects as getters/setters for the properties

2009-02-10 Thread Gennadiy Rozental
Hi, I need to implement some translation in a getter and setter for particular field. I am getting compile time errors, I am not sure how to fix. I am using 1.33.1. Here is what I do: template struct Getter { explicit Getter( MyClass T::* mem ) : m_member( mem ) {} bp::object operat

Re: [C++-sig] can these exports be avoided

2008-11-10 Thread Gennadiy Rozental
Hans Meine informatik.uni-hamburg.de> writes: > > On Monday 10 November 2008 08:56:14 Gennadiy Rozental wrote: > > It can be resolved with additional export for class Derived: > > > > bp::class_,noncopyable> > > ( "Derived", bp::no_init ); >

Re: [C++-sig] can these exports be avoided

2008-11-10 Thread Gennadiy Rozental
Patrick Atambo gmail.com> writes: > > > I'd say you have 2 options depending > > Containment. This would require an API class that you export to Python with methods that call your implementation and it's my favorite since from here you can control what is used when calling your implementat

[C++-sig] can these exports be avoided

2008-11-09 Thread Gennadiy Rozental
Simple scenario: class IObject {}; class Base : public IObject { public: virtual void foo() {} }; class Derived : public Base { virtual void foo() {} }; Both IObject and Base are exported into Python: bp::class_( "IObject", bp::no_init ); bp::class_,noncopyable>( "Base", bp::no_init )