From 2663e73f1cbf3b0bf461000f9ff1fafb30137f32 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Thu, 20 Feb 2003 20:28:05 +0000 Subject: [PATCH] Automatically add library-path values to RUN_PATH/RUN_LD_LIBRARY_PATH [SVN r17562] --- src/object/enum.cpp | 8 ++++++-- test/Jamfile | 1 + test/auto_ptr.cpp | 10 ++++++++++ test/auto_ptr.py | 32 +++++++++++++++++++++++++++++--- 4 files changed, 46 insertions(+), 5 deletions(-) diff --git a/src/object/enum.cpp b/src/object/enum.cpp index c658ead2..c297abb7 100644 --- a/src/object/enum.cpp +++ b/src/object/enum.cpp @@ -148,9 +148,13 @@ namespace dict d; d["__slots__"] = tuple(); d["values"] = dict(); - + + object module_name = module_prefix(); + if (module_name) + module_name += '.'; + object result = (object(metatype))( - module_prefix() + name, make_tuple(base), d); + module_name + name, make_tuple(base), d); scope().attr(name) = result; diff --git a/test/Jamfile b/test/Jamfile index f667159b..d71c02fa 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -153,6 +153,7 @@ run result.cpp ; compile string_literal.cpp ; compile borrowed.cpp : $(UNIT_TEST_PROPERTIES) ; compile object_manager.cpp : $(UNIT_TEST_PROPERTIES) ; +compile copy_ctor_mutates_rhs.cpp : $(UNIT_TEST_PROPERTIES) ; run upcast.cpp ../../test/build/boost_test_exec_monitor : # command-line args diff --git a/test/auto_ptr.cpp b/test/auto_ptr.cpp index 36b4b5dc..ad682304 100644 --- a/test/auto_ptr.cpp +++ b/test/auto_ptr.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include "test_class.hpp" #include @@ -16,6 +17,11 @@ using namespace boost::python; typedef test_class<> X; +struct Y : X +{ + Y(int n) : X(n) {}; +}; + int look(std::auto_ptr const& x) { return (x.get()) ? x->value() : -1; @@ -60,6 +66,10 @@ BOOST_PYTHON_MODULE(auto_ptr_ext) .def("value", &X::value) ; + class_, bases, boost::noncopyable>("X", init()) + ; + + implicitly_convertible, std::auto_ptr >(); def("look", look); def("steal", steal); def("maybe_steal", maybe_steal); diff --git a/test/auto_ptr.py b/test/auto_ptr.py index 7c6ce51f..e31feb25 100644 --- a/test/auto_ptr.py +++ b/test/auto_ptr.py @@ -3,7 +3,6 @@ >>> x = X(42) >>> x.value() 42 - >>> look(x), look(x) (42, 42) @@ -32,12 +31,39 @@ >>> look(x) 77 ->>> y = callback(lambda y: y) ->>> y.value() +>>> z = callback(lambda z: z) +>>> z.value() 77 >>> extract(x).value() 77 + +# +# Test derived to base conversions +# + +>>> y = Y(42) +>>> y.value() +42 + +>>> maybe_steal(y, 0) +42 + +>>> try: maybe_steal(y, 0) +... except TypeError: pass +... else: print 'expected a TypeError exception' + +>>> y.value() +42 + +>>> steal(y) +42 + +>>> if not '--broken-auto-ptr' in sys.argv: +... try: y.value() +... except TypeError: pass +... else: print 'expected a TypeError exception' + ''' def run(args = None):