mirror of
https://github.com/boostorg/python.git
synced 2026-01-26 18:52:26 +00:00
New function invocation mechanism. This is the major groundwork for handling virtual functions with default implementations properly
[SVN r16388]
This commit is contained in:
@@ -199,6 +199,9 @@ D take_d_shared_ptr(boost::shared_ptr<D> d) { return *d; }
|
||||
|
||||
boost::shared_ptr<A> d_factory() { return boost::shared_ptr<B>(new D); }
|
||||
|
||||
struct Unregistered {};
|
||||
Unregistered make_unregistered(int) { return Unregistered(); }
|
||||
|
||||
BOOST_PYTHON_MODULE(m1)
|
||||
{
|
||||
using namespace boost::python;
|
||||
@@ -222,6 +225,8 @@ BOOST_PYTHON_MODULE(m1)
|
||||
def("new_noddy", new_noddy);
|
||||
def("new_simple", new_simple);
|
||||
|
||||
def("make_unregistered", make_unregistered);
|
||||
|
||||
// Expose f() in all its variations
|
||||
def("f", f);
|
||||
def("f_mutable_ref", f_mutable_ref);
|
||||
|
||||
@@ -3,6 +3,17 @@
|
||||
|
||||
>>> from m2 import *
|
||||
|
||||
Prove that we get an appropriate error from trying to return a type
|
||||
for which we have no registered to_python converter
|
||||
|
||||
>>> try:
|
||||
... make_unregistered(1)
|
||||
... except TypeError, x:
|
||||
... if not str(x).startswith('No to_python (by-value) converter found for C++ type'):
|
||||
... print str(x)
|
||||
... else:
|
||||
... print 'expected a TypeError'
|
||||
|
||||
>>> n = new_noddy()
|
||||
>>> s = new_simple()
|
||||
>>> unwrap_int(n)
|
||||
|
||||
Reference in New Issue
Block a user