-----------
1. The algorithm, which calculates what member functions should be redefined in
derived class wrappers, was improved. Many thanks to Julian Scheid for the bug
fix.
The change explanation.
.. code-block:: c++
struct A{
virtual void foo() {}
};
class B: public A{
};
Previous version of :doc:`Py++ <index>` didn't generate wrapper for class ``B``, even
though ``B`` inherits ``A``'s virtual function. Now if you have the following
Python code:
.. code-block:: python
class C(B):
def __init__( self ):
B.__init__(self)
def foo(self):
print "C.foo"
then when ``foo`` is invoked on this instance on the C++ side of things, the
Python code won't be executed as the wrapper was missing.
**Warning!** **There is a possibility that your generated code will not work!**
**Keep reading.**
If you use "function transformation" functionality, than it is possible the
generated code will **NOT** work. Consider the following example:
.. code-block:: c++
struct A{
virtual void foo(int& i) {/*do smth*/}
};
class B: public A{
virtual void foo(int& i) {/*do smth else*/}
};
The :doc:`Py++ <index>` code:
.. code-block:: python
from pyplusplus import module_builder
from pyplusplus import function_transformers as FT
mb = module_builder_t( ... )
foo = mb.member_functions( 'foo' )
foo.add_transformation( FT.output(0) )
The generated code, for class ``B``, is:
.. code-block:: c++
namespace bp = boost::python;
struct B_wrapper : B, bp::wrapper< B > {
virtual void foo( int & i ) const { ... }
static boost::python::tuple default_foo( ::B const & inst )
{ ... }
virtual void foo( int & i ) const
{ ... }
static boost::python::object default_foo( ::A const & inst )
{ ... }
};
...
bp::class_< B_wrapper, bp::bases< A > >( "B" )
.def( "foo", (boost::python::tuple (*)( ::B const & ))( &B_wrapper::default_foo ) )
.def( "foo", (boost::python::object (*)( ::A const & ))( &B_wrapper::default_foo ) );
As you can see, after applying the transformation both functions have same
signature. Do you know what function will be called in some situation? I do -
the wrong one :-(.
Unfortunately, there is no easy work around or some trick that you can use,
which will not break the existing code. I see few solutions to the problem:
* change the alias of the functions
.. code-block:: python
from pyplusplus import module_builder
from pyplusplus import function_transformers as FT
mb = module_builder_t( ... )
foo = mb.member_functions( '::A::foo' ).add_transformation( FT.output(0), alias="foo_a" )
foo = mb.member_functions( '::B::foo' ).add_transformation( FT.output(0), alias="foo_b" )
* use ``inout`` transformation - it preserves a function signature
* :doc:`Py++ <index>` can introduce a configuration, that will preserve the previous behaviour.
I think this is a wrong way to go and doing the API changes is the 'right'
longer term solution.
If you **absolutely need** to preserve API backward compatible, contact me
and I will introduce such configuration option.
Sorry for inconvenience.
2. Few bugs, related to Indexing Suite 2, were fixed. Many thanks to Oliver Schweitzer
for reporting them.
3. New and highly experimental feature was introduced -
:doc:`Boost.Python and ctypes integration <ctypes/ctypes_integration>`.
4. Support for :doc:`boost::python::make_constructor <functions/make_constructor>` functionality was added.
5. Support for unions and unnamed classes was added.
6. Doxygen documentation extractor was improved. Many thanks to Hernán Ordiales.
7. Py++ documentation was improved. Many thanks to Bernd Fritzke.
-------------