mirror of
https://github.com/boostorg/python.git
synced 2026-01-21 05:02:17 +00:00
Bug fix, thanks to Nicolas LELONG, nlelong-at-mgdesign.org for the report.
[SVN r20401]
This commit is contained in:
@@ -280,7 +280,7 @@ namespace api
|
||||
return object_initializer<
|
||||
BOOST_DEDUCED_TYPENAME unwrap_reference<T>::type
|
||||
>::get(
|
||||
api::do_unforward_cref(x)
|
||||
x
|
||||
, is_obj()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6,9 +6,19 @@
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
#include <boost/python/object.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
|
||||
using namespace boost::python;
|
||||
|
||||
class NotCopyable
|
||||
{
|
||||
} not_copyable;
|
||||
|
||||
object ref_to_noncopyable()
|
||||
{
|
||||
return object(boost::ref(not_copyable));
|
||||
}
|
||||
|
||||
object call_object_3(object f)
|
||||
{
|
||||
return f(3);
|
||||
@@ -281,6 +291,9 @@ bool check_inplace(object l, object o)
|
||||
|
||||
BOOST_PYTHON_MODULE(object_ext)
|
||||
{
|
||||
class_<NotCopyable, boost::noncopyable>("NotCopyable", no_init);
|
||||
|
||||
def("ref_to_noncopyable", ref_to_noncopyable);
|
||||
def("call_object_3", call_object_3);
|
||||
def("message", message);
|
||||
def("number", number);
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
'''
|
||||
>>> from object_ext import *
|
||||
|
||||
>>> class(ref_to_noncopyable())
|
||||
object_ext.NotCopyable
|
||||
|
||||
>>> def print1(x):
|
||||
... print x
|
||||
>>> call_object_3(print1)
|
||||
|
||||
Reference in New Issue
Block a user