> Dag Sverre Seljebotn wrote: >> Allocation would happen through an actual (as light-weight as >> possible, and probably mostly opaque, perhaps doing as much as printing >> the C++ name of the class in its repr) Python object > > That wouldn't work, though. Imagine you'd return the C++ object pointer > from a function. What would happen to the Python object that holds it? How > would you keep the ref-counting context for it?
There would be no coercion between pointers and refcounted variables. I.e. if you have cdef extern CppObject* foo() you can NOT do cdef CppObject obj = foo() It would only work when C++ returned an object *by value*: cdef extern CppObject foo() cdef CppObject obj = foo() This would then heap-allocate a CppObject, passing in the object that is returned to the copy constructor. We *could* perhaps add manual conversion from pointers, with a "managed" boolean keyword etc., but that is something else entirely. Robert, this answers your problems with it as well I believe. Dag Sverre _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
