Hello,

I have created a Python wrapper using a custom smart pointer that 
is defined 
in the following manner:

class_<EventWrapper, 
noncopyable, Ptr<EventWrapper>>("Event", init<>())
    
.def("f", &Event::f, &EventWrapper::default_f).
  
implicitely_convertible<Ptr<EventWrapper>, Ptr<Event>>();
  
register_ptr_to_python<Ptr<Event>>();

Now... when I subclass 
this in Python like so:

class MyEvent(Event):
  def f(self):
    
return 42

I can use MyEvent as expected only within Python code... when I 
pass an 
instance of MyEvent to C++, and then C++ passes MyEvent back 
to
Python, I no longer am able to call the overridden method f in 
Python.
Calling f in Python invokes Event::f, as opposed to 
MyEvent.f

This only happens when I construct MyEvent in Python code, pass 
the instance 
to some C++ code, and have the C++ code pass back the 
MyEvent instance
back to Python.

Any ideas why this may 
be?

Thanks. 

_________________________________________________________________
Share photos with friends on Windows Live Messenger
http://go.microsoft.com/?linkid=9650734
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to