From 4f129d035bab45cfff16d87a970e749aa97da3d7 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Fri, 17 Oct 2003 14:13:48 +0000 Subject: [PATCH] Bug fix, thanks to Nicolas LELONG, nlelong-at-mgdesign.org for the report. [SVN r20401] --- include/boost/python/object_core.hpp | 2 +- test/object.cpp | 13 +++++++++++++ test/object.py | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/include/boost/python/object_core.hpp b/include/boost/python/object_core.hpp index a9b51ac6..eb59c52c 100755 --- a/include/boost/python/object_core.hpp +++ b/include/boost/python/object_core.hpp @@ -280,7 +280,7 @@ namespace api return object_initializer< BOOST_DEDUCED_TYPENAME unwrap_reference::type >::get( - api::do_unforward_cref(x) + x , is_obj() ); } diff --git a/test/object.cpp b/test/object.cpp index bf702099..dfaec695 100755 --- a/test/object.cpp +++ b/test/object.cpp @@ -6,9 +6,19 @@ #include #include #include +#include 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", no_init); + + def("ref_to_noncopyable", ref_to_noncopyable); def("call_object_3", call_object_3); def("message", message); def("number", number); diff --git a/test/object.py b/test/object.py index 73d72329..41359a6c 100644 --- a/test/object.py +++ b/test/object.py @@ -1,5 +1,9 @@ ''' >>> from object_ext import * + +>>> class(ref_to_noncopyable()) +object_ext.NotCopyable + >>> def print1(x): ... print x >>> call_object_3(print1)