Re: [C++-sig] Best practices for wrapping classes where instance lifecycle is managed by someone else?

2010-07-09 Thread Renato Araujo
Hi Mikael Lind Check: http://www.boost.org/doc/libs/1_43_0/libs/python/doc/v2/with_custodian_and_ward.html#with_custodian_and_ward-spec, if this not work to your problem this can help you to implement a new policy. BR Renato Araujo Oliveira Filho On Fri, Jul 9, 2010 at 5:05 AM, Mikael Lind

Re: [C++-sig] PyGILState_Release with multithread

2010-02-02 Thread Renato Araujo
Remember of use PyEval_InitThreads on your module initialization. Renato Araujo Oliveira Filho On Tue, Feb 2, 2010 at 2:30 PM, Matthew Scouten (TT) < matthew.scou...@tradingtechnologies.com> wrote: > First of all, the PyGILState_* functions are acquiring and releasing the

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

2010-01-06 Thread Renato Araujo
n can produce some new bytes. :( Renato Araujo Oliveira Filho On Tue, Dec 22, 2009 at 12:42 AM, Troy D. Straszheim wrote: > Dane Springmeyer writes: > >> Troy, >> >> Incidentally, do you know the proper way  (or is there a proper way?) >> to support None t

Re: [C++-sig] Avoid Implicitly conversion for non direct conversion

2010-01-06 Thread Renato Araujo
Hi thanks for you help, On Wed, Jan 6, 2010 at 4:59 AM, Hans Meine wrote: > On Dienstag 05 Januar 2010, Renato Araujo wrote: >> I would like to know if is possible to avoid this level of conversion >> and tell to boost.python only try the direct conversion, > > Not as far as

[C++-sig] Avoid Implicitly conversion for non direct conversion

2010-01-05 Thread Renato Araujo
def("value", value); class_("X", init()) ; class_("Y", init()) ; implicitly_convertible(); implicitly_convertible(); } --- BR Renato Araujo Oliveira Filho __

Re: [C++-sig] function with >15 args yields get_signature error

2009-10-26 Thread Renato Araujo
Hi, Try use this flag in your compilation, -DBOOST_PYTHON_MAX_ARITY=XX The default value is 15, the I think thi can solve your problem. BR Renato Araujo Oliveira Filho On Mon, Oct 26, 2009 at 2:01 PM, Eilif Mueller wrote: > Hi, > > Wrapping a function f with 16 arguments: > &g

Re: [C++-sig] Boost Python objects and object identity

2009-09-29 Thread Renato Araujo
pointer to most-derived type and use this as key in my hash table. BR Renato Araujo Oliveira Filho 2009/9/29 Pertti Kellomäki : > I have Python bindings for a C++ library that among other > things contains classes for describing the static structure > of a microprocessor. > > My b

Re: [C++-sig] boost.python - C++ class overridden in python causes slicing

2009-09-08 Thread Renato Araujo
Hi Jean, You can use "boost::python::ptr(your_cpp_cpointer)" this avoid create unecessary copies. BR Renato Araujo Oliveira Filho On Tue, Sep 8, 2009 at 11:41 PM, Jean-Sébastien Guay wrote: > Hi all, > > I found an post from earlier this year to this list where Da

Re: [C++-sig] [GSoC] Boost.Python py3k support project final report

2009-09-01 Thread Renato Araujo
Congratulations, I will wait for get this merged in mainline for start some work in PySide. Renato Araujo Oliveira Filho On Tue, Sep 1, 2009 at 1:19 AM, Haoyu Bai wrote: > Hi, > > As GSoC is officially finished, this is the final report of the > Boost.Python py3k(Python 3) sup

Re: [C++-sig] AttributeError: 'Boost.Python.StaticProperty' object attribute '__doc__' is read-only

2009-08-31 Thread Renato Araujo
o::bar) to add_property("bar", setter_property_bar). I will try find the problem in boost source but for now this change can solve the problem. BR Renato Araujo Oliveira Filho On Sun, Aug 30, 2009 at 4:40 AM, VáclavŠmilauer wrote: > Such is the shortest example I am able to isolate

[C++-sig] use of hash to map c++ pointers with python objects

2009-08-28 Thread Renato Araujo
s the pointer address to another region of memory, causing a mess in my hash. I would like to know if someone has any idea about how to solve this problem. How can I map a c++ pointer to a PyObject between libraries without use dynamic_cast. I have attached a small use case for this case. Renato A

[C++-sig] PySide has been released

2009-08-18 Thread Renato Araujo
Hi, The PySide team is pleased to announce the first public release of PySide: Python for Qt! PySide, its documentation, and developer resources are available at the project website, http://www.pyside.org . What is it? --- PySide is a project providing an LGPL'd set of Python bindings f

Re: [C++-sig] How to correctly expose back shared_ptr-ed Python object to C++

2009-08-08 Thread Renato Araujo
<<<<<<<<<<<<<< here this need be called explicitly > self.handle_type = 2 > def canHandle(self, type): > return type == handle_type > def handle(self): > print "handle() from python plugin" BR

Re: [C++-sig] Boost.Python: same class in several modules

2009-07-14 Thread Renato Araujo
gt; ___ > Cplusplus-sig mailing list > Cplusplus-sig@python.org > http://mail.python.org/mailman/listinfo/cplusplus-sig > ___ > Cplusplus-sig mailing list > Cplusplus-sig@python.org > http://mail.python.org/mailman/listinfo/cplusplus-sig > -- Renato Araujo Oliveira Filho ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig

Re: [C++-sig] boost::python and threads

2009-07-08 Thread Renato Araujo
e thread_; >          } >      } > >      virtual void onTick() { get_override("onTick")(); } >      void default_onTick() {} >  }; > >  BOOST_PYTHON_MODULE(tick) >  { >      class_ ("Ticker") >          .def("run", &Ticker::run) >          

Re: [C++-sig] Passing Python classes derived from C++ back into C++

2009-07-07 Thread Renato Araujo
;::maybe_register_pointer_to_python(void*, > void*, mpl_::bool_<1>*)". > > I also tried extending the boost::python::wrapper using get_override() > instead of call_method(), but as it can not be constructed with a > PyObject * so th

Re: [C++-sig] exposing pointer to Python

2009-07-06 Thread Renato Araujo
t; ___ > Cplusplus-sig mailing list > Cplusplus-sig@python.org > http://mail.python.org/mailman/listinfo/cplusplus-sig > -- Renato Araujo Oliveira Filho ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig

Re: [C++-sig] boost::python and threads

2009-07-06 Thread Renato Araujo
fe77ef14), at 0xfee15ca0 > > > > "Paul Scruby" wrote in message > news:h2sgic$ad...@ger.gmane.org... >> Hiya, >> >> That's fantastic, all I needed to do was to put PyGILState_Ensure(); >> before my virtual function calls into python from another

Re: [C++-sig] how to extract an instance of arbitrary c++ class from python object?

2009-07-04 Thread Renato Araujo
o make it in one operation. > Thanks > > Alexey > > _______ > Cplusplus-sig mailing list > Cplusplus-sig@python.org > http://mail.python.org/mailman/listinfo/cplusplus-sig > -- Renato Araujo Oliveira Filho ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig

Re: [C++-sig] boost::python and threads

2009-07-04 Thread Renato Araujo
gt;    msvcr90d.dll!_callthreadstartex()  Line 348 + 0xf bytes C >    msvcr90d.dll!_threadstartex(void * ptd=0x00d46938)  Line 331 C >    kernel32.dll!7c80b729() > > > Have a missed a trick using the wrapper, or does boost::python not support > threading? > > Many thanks, > > Paul > > > > ___ > Cplusplus-sig mailing list > Cplusplus-sig@python.org > http://mail.python.org/mailman/listinfo/cplusplus-sig > ___ > Cplusplus-sig mailing list > Cplusplus-sig@python.org > http://mail.python.org/mailman/listinfo/cplusplus-sig > ___ > Cplusplus-sig mailing list > Cplusplus-sig@python.org > http://mail.python.org/mailman/listinfo/cplusplus-sig > -- Renato Araujo Oliveira Filho ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig

Re: [C++-sig] wchar_t* type conversion

2009-06-22 Thread Renato Araujo
> ArgumentError                             Traceback (most recent call last) > > /home/.../build/ in () > > ArgumentError: Python argument types in >    Test.testArgument(Test, str) > did not match C++ signature: >    testArgument(Test {lvalue}, wchar_t*) > >>

Re: [C++-sig] wchar_t* type conversion

2009-06-22 Thread Renato Araujo
Any thoughts? > > > Thanks in advance! > > -- > Nicolas Lara > Linux user #380134 > http://nicolas-lara.blogspot.com/ > Public key id: 0x152e7713 at http://subkeys.pgp.net/ > ___ > Cplusplus-sig mailing list > Cplusplus-sig@python.org > http://mail.python.org/mailman/listinfo/cplusplus-sig > -- Renato Araujo Oliveira Filho ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig

Re: [C++-sig] Avoiding copying non-copyables

2009-06-15 Thread Renato Araujo
peError: No Python class registered for C++ class class ResourceManager > > # > > Am I doing this wrong? Wrong return policy? > > Thanks > > Simon > > > _______ > Cplu

Re: [C++-sig] Wrapping functions that return a raw pointer

2009-05-03 Thread Renato Araujo
; > > BOOST_PYTHON_MODULE(test) > { >    using namespace boost::python; > >    class_("test") >        .def("get", &test::get); > } > > Thanks > > ___ > Cplusplus-sig mailing list > Cplusplus-sig@py

[C++-sig] python objects not is the same in separated modules

2009-04-22 Thread Renato Araujo
c print t == c this happen when I use "Other" object in "setChild" and "child" function. when I use "Base" object works fine. I put a small example annexed in this e-mail. -- BR Renato Araujo Oliveira Filho boosttest.tar.gz Description: GNU Zip compres

Re: [C++-sig] boost python and shared_ptr

2009-04-19 Thread Renato Araujo
g like this(pseudocode): > class A  {   object _self; }; > > if (a->_self == 0) >    a->_self = makePyObjectForExistingClass(this) > return _self > > > and this PyObject should be deleted automatically when object will die in > C++ > > > >

Re: [C++-sig] method chaining in noncopyable derived class

2009-04-08 Thread Renato Araujo
mething",&Derived::setSomething, > return_value_policy()) >         //.def("setSomething",&Derived::setSomething, > return_value_policy()); > } > > ___ > Cplusplus-sig mailing list > Cplusplus-sig@python.org > http://mail.python.org/mailman/listinfo/cplusplus-sig > -- Renato Araujo Oliveira Filho ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig

Re: [C++-sig] Protected virtual Functions with default implementation

2009-03-23 Thread Renato Araujo
test. My question is, how export this protected virtual function? the way used in Py++ not work in this case. Thanks On Mon, Mar 23, 2009 at 5:57 AM, Roman Yakovenko wrote: > 2009/3/19 Renato Araujo : >> Hi guys, I'm working again in my bindings generation and I get a new >> qu

Re: [C++-sig] gcc flag -fvisibility=hidden not working with boost::python

2009-03-23 Thread Renato Araujo
For more details about the problem, I found the correct header witch give me this problem, and isolate that with this: #include # include # include #pragma GCC visibility push(default) #include #pragma GCC visibility pop #include BR Renato On Sun, Mar 22, 2009 at 12:36 PM, Renato Araujo

Re: [C++-sig] gcc flag -fvisibility=hidden not working with boost::python

2009-03-22 Thread Renato Araujo
y pop #include You can try this only changing the "foo/python_headers.h" file in my previous example. I don't know if this is the correct way to fix this. Someone can talk about? BR On Sat, Mar 21, 2009 at 5:38 PM, Niall Douglas wrote: > On 20 Mar 2009 at 13:46, Renato Ar

[C++-sig] gcc flag -fvisibility=hidden not working with boost::python

2009-03-20 Thread Renato Araujo
test to show the problem. This flags is very important for me because I got size reduction about 50% with this. Thanks -- Renato Araujo Oliveira Filho boosttest_visibility.tar Description: Unix tar archive ___ Cplusplus-sig mailing list Cplu

[C++-sig] Protected virtual Functions with default implementation

2009-03-19 Thread Renato Araujo
all cases. I have attached the test case on this e-mail, if someone would like to try my implementation. BR -- Renato Araujo Oliveira Filho boosttest.tar Description: Unix tar archive ___ Cplusplus-sig mailing list Cplusplus-sig@pytho

Re: [C++-sig] "extension class wrapper for base class has not been created yet" error message on Linux for a project that works fine on Windows

2009-02-04 Thread Renato Araujo
; > #endif //DERIVED_BAR_H > > Bar.cpp > #include > #include "Bar.h" > > using namespace Derived; > > Bar::Bar() : Base::Foo() > { > }; > > Bar::~Bar() > { > }; > > void Bar::sayHello() > { > std::cout << "Hi I am Bar!" << std:: endl; > } > > BarWrapper.cpp > #include > #include >

[C++-sig] virtual functions and bind size reduction

2009-01-30 Thread Renato Araujo
some idea how solve this, or a another way to save some calls of ".def" functions. -- Renato Araujo Oliveira Filho testboost.tar Description: Unix tar archive ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig

Re: [C++-sig] bindings size

2009-01-27 Thread Renato Araujo
anks. On Mon, Jan 26, 2009 at 8:06 PM, Ralf W. Grosse-Kunstleve wrote: > Are you wrapping many trivial (member) functions? > > > > - Original Message > From: Renato Araujo > To: Development of Python/C++ integration > Sent: Monday, January 26, 2009 6:16:59 AM &

Re: [C++-sig] bindings size

2009-01-26 Thread Renato Araujo
my bindings. > > Cheers, > Niall > > On 23 Jan 2009 at 15:51, Renato Araujo wrote: > >> hi David, >> >> This size is about my library, when I use "class_" and ".def()" >> templates from libboost_python. And about the g++ flags I use -Os >>

Re: [C++-sig] bindings size

2009-01-23 Thread Renato Araujo
Thanks On Fri, Jan 23, 2009 at 2:43 PM, David Abrahams wrote: > > on Fri Jan 23 2009, Renato Araujo wrote: > >> I'm current using "CXXFLAGS=-ffunction-sections -Os" and "LDFLAGS >> --gc-sections", and the library already striped, without strip the

Re: [C++-sig] bindings size

2009-01-23 Thread Renato Araujo
I'm current using "CXXFLAGS=-ffunction-sections -Os" and "LDFLAGS --gc-sections", and the library already striped, without strip the size is about 12MB. On Fri, Jan 23, 2009 at 1:31 PM, David Abrahams wrote: > > on Fri Jan 23 2009, Renato Araujo wrote: > >&

[C++-sig] bindings size

2009-01-23 Thread Renato Araujo
all instead of ".def" functions, to minimize template usage, or some template call that I can transform into a function call. Anyway if there is work in progress to minimize the size of boost-python bindings I am very eager to help. BR -

[C++-sig] custom constructor problems

2008-12-15 Thread Renato Araujo
it from "python::wrapper". Then I think all classes have implicit conversion to "shared_ptr" correct? BR -- Renato Araujo Oliveira Filho ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig

Re: [C++-sig] take ownership in a call policy

2008-12-12 Thread Renato Araujo
t no have parent. On Fri, Dec 12, 2008 at 8:08 PM, David Abrahams wrote: > > on Fri Dec 12 2008, "Renato Araujo" wrote: > >> Hi guys, >> >> I'm creating a 2 new call_policy to my functions where I need take and >> give back the ownership of my obje

[C++-sig] take ownership in a call policy

2008-12-12 Thread Renato Araujo
this? How I can get a ref to auto_ptr or shared_ptr from my PyObject? Thanks -- Renato Araujo Oliveira Filho ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig

Re: [C++-sig] Getting address of wrapped instance?

2008-12-08 Thread Renato Araujo
rence the same > C++ instance I can't use id() or repr() of the Python object. > > Thanks, > Paul > > ___ > Cplusplus-sig mailing list > Cplusplus-sig@python.org > http://mail.python.org/mailman

Re: [C++-sig] PyObject RefCount

2008-12-03 Thread Renato Araujo
, Dec 3, 2008 at 4:16 PM, Stefan Seefeld <[EMAIL PROTECTED]> wrote: > Renato Araujo wrote: >> >> Hi all, >> >> I'm trying check if have someone using my object in python, but I got >> some problems I think I'm not doing this in the correct way:

[C++-sig] PyObject RefCount

2008-12-03 Thread Renato Araujo
e best way to do this? Thanks -- Renato Araujo Oliveira Filho ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig

Re: [C++-sig] boost.python: private copy constructor problem

2008-12-02 Thread Renato Araujo
l/temporary/boost_1_37_0/boost/python/object/value_holder.hpp: In > constructor > 'boost::python::objects::value_holder::value_holder(PyObject*, A0) > [with A0 = boost::reference_wrapper, Value = B]': > /home/mihail/temporary/boost_1_37_0/boost/python/object/value_holder.hpp

Re: [C++-sig] class properties for functions returning references

2008-11-27 Thread Renato Araujo
y, but both give compilation errors. > > Any help is appreciated > > regards, > anirudh > > ___ > Cplusplus-sig mailing list > Cplusplus-sig@python.org > http://mail.python.org/mailman/listinfo/cplusplus-sig > -- Renato Araujo Oliveira Filho ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig

[C++-sig] shared_ptr with custom destructor

2008-11-24 Thread Renato Araujo
ng more generic where I can declare in class_ template, something like that: class_ ("MyObject") ... There is something like that? How is the best way to do this? BR -- Renato Araujo Oliveira Filho ___ Cplusplus-sig mailing l

Re: [C++-sig] Instance access

2008-11-24 Thread Renato Araujo
et <[EMAIL PROTECTED]> > > ___ > Cplusplus-sig mailing list > Cplusplus-sig@python.org > http://mail.python.org/mailman/listinfo/cplusplus-sig > -- Renato Araujo Oliveira Filho ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig

Re: [C++-sig] looking up functions

2008-11-13 Thread Renato Araujo
> Reclaim your name @ymail.com or @rocketmail.com. Get your new email address > now! Go to http://ca.promos.yahoo.com/jacko/ > ___ > Cplusplus-sig mailing list > Cplusplus-sig@python.org > http://mail.p

Re: [C++-sig] c++ object deleted

2008-11-12 Thread Renato Araujo
wrote: > Renato Araujo wrote: >> >> Hi all, >> >> Is possible in boost::python create a exception when the c++ object is >> deleted internal, and you try use the python object. Because here I >> got a core when I try do this. >> > > I'm not sure

[C++-sig] c++ object deleted

2008-11-12 Thread Renato Araujo
Hi all, Is possible in boost::python create a exception when the c++ object is deleted internal, and you try use the python object. Because here I got a core when I try do this. BR -- Renato Araujo Oliveira Filho ___ Cplusplus-sig mailing list

Re: [C++-sig] Using destructors in the right way

2008-11-06 Thread Renato Araujo
Hi Luciano You can use in your class definition something like that: class_ but I don't know why this not work when you have custom constructors like that: class_ ("MyClass", python::no_init) .def("__init__", python::make_constructor(my_constructor)) BR Renato On Tue, Nov 4, 2008 a

Re: [C++-sig] Contructor with "with_custodian_and_ward_postcall"

2008-11-04 Thread Renato Araujo
oost_python-py25.so.1.35.0) I think there is a way to communicate to boost to remove my objet form your object list. How I can do this? This is the correct way?? Have a best boost way to do this?? BR -- Renato Araujo Oliveira Filho On Mon, Nov 3, 2008 at 4:15 PM, Renato Araujo <[EMAIL PRO

[C++-sig] Fwd: Contructor with "with_custodian_and_ward_postcall"

2008-11-03 Thread Renato Araujo
Sorry my last message I sent incomplete :) I will try again. First I have a c++ class like this: struct object { object(object *parent=0) // if parent !=NULL append this at parent children list ~object() //Destroy all children }; Is possible implement this using "python::with_custo

Re: [C++-sig] Contructor with "with_custodian_and_ward_postcall"

2008-11-03 Thread Renato Araujo
;? I tried some like that: qclass_ ("object", python::init<> ()) //here i put self will be the ward and arg 2 (parent) will be the custodian or .def(python::init()[python::with_custodian_and_ward_postcall<2,1>()]) On Mon, Nov 3, 2008 at 12:48 PM, Renato Araujo

[C++-sig] Contructor with "with_custodian_and_ward_postcall"

2008-11-03 Thread Renato Araujo
t this not compile, because the "with_custodian_and_ward" need a function with 2 args like (self, parent) how can I solve this problem? -- Renato Araujo Oliveira Filho ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig

Re: [C++-sig] new to python; old to C++

2008-10-31 Thread Renato Araujo
usplus-sig > > > > __ > Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your > favourite sites. Download it now at > http://ca.toolbar.yahoo.com. >