diff --git a/example/do_it_yourself_converters.cpp b/example/do_it_yourself_converters.cpp index 064f2f0c..29a1dd66 100644 --- a/example/do_it_yourself_converters.cpp +++ b/example/do_it_yourself_converters.cpp @@ -95,7 +95,7 @@ BOOST_PYTHON_BEGIN_CONVERSION_NAMESPACE // Convert a MillerIndex object to a Python tuple. // - PyObject* to_python(python::semantics, const MillerIndex& hkl) + PyObject* to_python(const MillerIndex& hkl, python::lookup_tag) { python::tuple result(3); for (int i = 0; i < 3; i++) diff --git a/include/boost/python/callback.hpp b/include/boost/python/callback.hpp index b9e850c6..533f3ac8 100644 --- a/include/boost/python/callback.hpp +++ b/include/boost/python/callback.hpp @@ -46,7 +46,7 @@ struct callback template static R call_method(PyObject* self, const char* name, const A1& a1) { - ref p1(to_python(search_namespace, a1)); + ref p1(to_python(a1, lookup_tag())); ref result(PyEval_CallMethod(self, const_cast(name), const_cast("(O)"), p1.get())); @@ -57,7 +57,7 @@ struct callback template static R call(PyObject* self, const A1& a1) { - ref p1(to_python(search_namespace, a1)); + ref p1(to_python(a1, lookup_tag())); ref result(PyEval_CallFunction(self, const_cast("(O)"), p1.get())); detail::callback_adjust_refcount(result.get(), type()); @@ -67,8 +67,8 @@ struct callback template static R call_method(PyObject* self, const char* name, const A1& a1, const A2& a2) { - ref p1(to_python(search_namespace, a1)); - ref p2(to_python(search_namespace, a2)); + ref p1(to_python(a1, lookup_tag())); + ref p2(to_python(a2, lookup_tag())); ref result(PyEval_CallMethod(self, const_cast(name), const_cast("(OO)"), p1.get(), @@ -80,8 +80,8 @@ struct callback template static R call(PyObject* self, const A1& a1, const A2& a2) { - ref p1(to_python(search_namespace, a1)); - ref p2(to_python(search_namespace, a2)); + ref p1(to_python(a1, lookup_tag())); + ref p2(to_python(a2, lookup_tag())); ref result(PyEval_CallFunction(self, const_cast("(OO)"), p1.get(), p2.get())); @@ -92,9 +92,9 @@ struct callback template static R call_method(PyObject* self, const char* name, const A1& a1, const A2& a2, const A3& a3) { - ref p1(to_python(search_namespace, a1)); - ref p2(to_python(search_namespace, a2)); - ref p3(to_python(search_namespace, a3)); + ref p1(to_python(a1, lookup_tag())); + ref p2(to_python(a2, lookup_tag())); + ref p3(to_python(a3, lookup_tag())); ref result(PyEval_CallMethod(self, const_cast(name), const_cast("(OOO)"), p1.get(), @@ -107,9 +107,9 @@ struct callback template static R call(PyObject* self, const A1& a1, const A2& a2, const A3& a3) { - ref p1(to_python(search_namespace, a1)); - ref p2(to_python(search_namespace, a2)); - ref p3(to_python(search_namespace, a3)); + ref p1(to_python(a1, lookup_tag())); + ref p2(to_python(a2, lookup_tag())); + ref p3(to_python(a3, lookup_tag())); ref result(PyEval_CallFunction(self, const_cast("(OOO)"), p1.get(), p2.get(), @@ -121,10 +121,10 @@ struct callback template static R call_method(PyObject* self, const char* name, const A1& a1, const A2& a2, const A3& a3, const A4& a4) { - ref p1(to_python(search_namespace, a1)); - ref p2(to_python(search_namespace, a2)); - ref p3(to_python(search_namespace, a3)); - ref p4(to_python(search_namespace, a4)); + ref p1(to_python(a1, lookup_tag())); + ref p2(to_python(a2, lookup_tag())); + ref p3(to_python(a3, lookup_tag())); + ref p4(to_python(a4, lookup_tag())); ref result(PyEval_CallMethod(self, const_cast(name), const_cast("(OOOO)"), p1.get(), @@ -138,10 +138,10 @@ struct callback template static R call(PyObject* self, const A1& a1, const A2& a2, const A3& a3, const A4& a4) { - ref p1(to_python(search_namespace, a1)); - ref p2(to_python(search_namespace, a2)); - ref p3(to_python(search_namespace, a3)); - ref p4(to_python(search_namespace, a4)); + ref p1(to_python(a1, lookup_tag())); + ref p2(to_python(a2, lookup_tag())); + ref p3(to_python(a3, lookup_tag())); + ref p4(to_python(a4, lookup_tag())); ref result(PyEval_CallFunction(self, const_cast("(OOOO)"), p1.get(), p2.get(), @@ -154,11 +154,11 @@ struct callback template static R call_method(PyObject* self, const char* name, const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5) { - ref p1(to_python(search_namespace, a1)); - ref p2(to_python(search_namespace, a2)); - ref p3(to_python(search_namespace, a3)); - ref p4(to_python(search_namespace, a4)); - ref p5(to_python(search_namespace, a5)); + ref p1(to_python(a1, lookup_tag())); + ref p2(to_python(a2, lookup_tag())); + ref p3(to_python(a3, lookup_tag())); + ref p4(to_python(a4, lookup_tag())); + ref p5(to_python(a5, lookup_tag())); ref result(PyEval_CallMethod(self, const_cast(name), const_cast("(OOOOO)"), p1.get(), @@ -173,11 +173,11 @@ struct callback template static R call(PyObject* self, const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5) { - ref p1(to_python(search_namespace, a1)); - ref p2(to_python(search_namespace, a2)); - ref p3(to_python(search_namespace, a3)); - ref p4(to_python(search_namespace, a4)); - ref p5(to_python(search_namespace, a5)); + ref p1(to_python(a1, lookup_tag())); + ref p2(to_python(a2, lookup_tag())); + ref p3(to_python(a3, lookup_tag())); + ref p4(to_python(a4, lookup_tag())); + ref p5(to_python(a5, lookup_tag())); ref result(PyEval_CallFunction(self, const_cast("(OOOOO)"), p1.get(), p2.get(), @@ -191,12 +191,12 @@ struct callback template static R call_method(PyObject* self, const char* name, const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6) { - ref p1(to_python(search_namespace, a1)); - ref p2(to_python(search_namespace, a2)); - ref p3(to_python(search_namespace, a3)); - ref p4(to_python(search_namespace, a4)); - ref p5(to_python(search_namespace, a5)); - ref p6(to_python(search_namespace, a6)); + ref p1(to_python(a1, lookup_tag())); + ref p2(to_python(a2, lookup_tag())); + ref p3(to_python(a3, lookup_tag())); + ref p4(to_python(a4, lookup_tag())); + ref p5(to_python(a5, lookup_tag())); + ref p6(to_python(a6, lookup_tag())); ref result(PyEval_CallMethod(self, const_cast(name), const_cast("(OOOOOO)"), p1.get(), @@ -212,12 +212,12 @@ struct callback template static R call(PyObject* self, const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6) { - ref p1(to_python(search_namespace, a1)); - ref p2(to_python(search_namespace, a2)); - ref p3(to_python(search_namespace, a3)); - ref p4(to_python(search_namespace, a4)); - ref p5(to_python(search_namespace, a5)); - ref p6(to_python(search_namespace, a6)); + ref p1(to_python(a1, lookup_tag())); + ref p2(to_python(a2, lookup_tag())); + ref p3(to_python(a3, lookup_tag())); + ref p4(to_python(a4, lookup_tag())); + ref p5(to_python(a5, lookup_tag())); + ref p6(to_python(a6, lookup_tag())); ref result(PyEval_CallFunction(self, const_cast("(OOOOOO)"), p1.get(), p2.get(), @@ -232,13 +232,13 @@ struct callback template static R call_method(PyObject* self, const char* name, const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7) { - ref p1(to_python(search_namespace, a1)); - ref p2(to_python(search_namespace, a2)); - ref p3(to_python(search_namespace, a3)); - ref p4(to_python(search_namespace, a4)); - ref p5(to_python(search_namespace, a5)); - ref p6(to_python(search_namespace, a6)); - ref p7(to_python(search_namespace, a7)); + ref p1(to_python(a1, lookup_tag())); + ref p2(to_python(a2, lookup_tag())); + ref p3(to_python(a3, lookup_tag())); + ref p4(to_python(a4, lookup_tag())); + ref p5(to_python(a5, lookup_tag())); + ref p6(to_python(a6, lookup_tag())); + ref p7(to_python(a7, lookup_tag())); ref result(PyEval_CallMethod(self, const_cast(name), const_cast("(OOOOOOO)"), p1.get(), @@ -255,13 +255,13 @@ struct callback template static R call(PyObject* self, const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7) { - ref p1(to_python(search_namespace, a1)); - ref p2(to_python(search_namespace, a2)); - ref p3(to_python(search_namespace, a3)); - ref p4(to_python(search_namespace, a4)); - ref p5(to_python(search_namespace, a5)); - ref p6(to_python(search_namespace, a6)); - ref p7(to_python(search_namespace, a7)); + ref p1(to_python(a1, lookup_tag())); + ref p2(to_python(a2, lookup_tag())); + ref p3(to_python(a3, lookup_tag())); + ref p4(to_python(a4, lookup_tag())); + ref p5(to_python(a5, lookup_tag())); + ref p6(to_python(a6, lookup_tag())); + ref p7(to_python(a7, lookup_tag())); ref result(PyEval_CallFunction(self, const_cast("(OOOOOOO)"), p1.get(), p2.get(), @@ -277,14 +277,14 @@ struct callback template static R call_method(PyObject* self, const char* name, const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8) { - ref p1(to_python(search_namespace, a1)); - ref p2(to_python(search_namespace, a2)); - ref p3(to_python(search_namespace, a3)); - ref p4(to_python(search_namespace, a4)); - ref p5(to_python(search_namespace, a5)); - ref p6(to_python(search_namespace, a6)); - ref p7(to_python(search_namespace, a7)); - ref p8(to_python(search_namespace, a8)); + ref p1(to_python(a1, lookup_tag())); + ref p2(to_python(a2, lookup_tag())); + ref p3(to_python(a3, lookup_tag())); + ref p4(to_python(a4, lookup_tag())); + ref p5(to_python(a5, lookup_tag())); + ref p6(to_python(a6, lookup_tag())); + ref p7(to_python(a7, lookup_tag())); + ref p8(to_python(a8, lookup_tag())); ref result(PyEval_CallMethod(self, const_cast(name), const_cast("(OOOOOOOO)"), p1.get(), @@ -302,14 +302,14 @@ struct callback template static R call(PyObject* self, const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8) { - ref p1(to_python(search_namespace, a1)); - ref p2(to_python(search_namespace, a2)); - ref p3(to_python(search_namespace, a3)); - ref p4(to_python(search_namespace, a4)); - ref p5(to_python(search_namespace, a5)); - ref p6(to_python(search_namespace, a6)); - ref p7(to_python(search_namespace, a7)); - ref p8(to_python(search_namespace, a8)); + ref p1(to_python(a1, lookup_tag())); + ref p2(to_python(a2, lookup_tag())); + ref p3(to_python(a3, lookup_tag())); + ref p4(to_python(a4, lookup_tag())); + ref p5(to_python(a5, lookup_tag())); + ref p6(to_python(a6, lookup_tag())); + ref p7(to_python(a7, lookup_tag())); + ref p8(to_python(a8, lookup_tag())); ref result(PyEval_CallFunction(self, const_cast("(OOOOOOOO)"), p1.get(), p2.get(), @@ -326,15 +326,15 @@ struct callback template static R call_method(PyObject* self, const char* name, const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9) { - ref p1(to_python(search_namespace, a1)); - ref p2(to_python(search_namespace, a2)); - ref p3(to_python(search_namespace, a3)); - ref p4(to_python(search_namespace, a4)); - ref p5(to_python(search_namespace, a5)); - ref p6(to_python(search_namespace, a6)); - ref p7(to_python(search_namespace, a7)); - ref p8(to_python(search_namespace, a8)); - ref p9(to_python(search_namespace, a9)); + ref p1(to_python(a1, lookup_tag())); + ref p2(to_python(a2, lookup_tag())); + ref p3(to_python(a3, lookup_tag())); + ref p4(to_python(a4, lookup_tag())); + ref p5(to_python(a5, lookup_tag())); + ref p6(to_python(a6, lookup_tag())); + ref p7(to_python(a7, lookup_tag())); + ref p8(to_python(a8, lookup_tag())); + ref p9(to_python(a9, lookup_tag())); ref result(PyEval_CallMethod(self, const_cast(name), const_cast("(OOOOOOOOO)"), p1.get(), @@ -353,15 +353,15 @@ struct callback template static R call(PyObject* self, const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9) { - ref p1(to_python(search_namespace, a1)); - ref p2(to_python(search_namespace, a2)); - ref p3(to_python(search_namespace, a3)); - ref p4(to_python(search_namespace, a4)); - ref p5(to_python(search_namespace, a5)); - ref p6(to_python(search_namespace, a6)); - ref p7(to_python(search_namespace, a7)); - ref p8(to_python(search_namespace, a8)); - ref p9(to_python(search_namespace, a9)); + ref p1(to_python(a1, lookup_tag())); + ref p2(to_python(a2, lookup_tag())); + ref p3(to_python(a3, lookup_tag())); + ref p4(to_python(a4, lookup_tag())); + ref p5(to_python(a5, lookup_tag())); + ref p6(to_python(a6, lookup_tag())); + ref p7(to_python(a7, lookup_tag())); + ref p8(to_python(a8, lookup_tag())); + ref p9(to_python(a9, lookup_tag())); ref result(PyEval_CallFunction(self, const_cast("(OOOOOOOOO)"), p1.get(), p2.get(), @@ -379,16 +379,16 @@ struct callback template static R call_method(PyObject* self, const char* name, const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9, const A10& a10) { - ref p1(to_python(search_namespace, a1)); - ref p2(to_python(search_namespace, a2)); - ref p3(to_python(search_namespace, a3)); - ref p4(to_python(search_namespace, a4)); - ref p5(to_python(search_namespace, a5)); - ref p6(to_python(search_namespace, a6)); - ref p7(to_python(search_namespace, a7)); - ref p8(to_python(search_namespace, a8)); - ref p9(to_python(search_namespace, a9)); - ref p10(to_python(search_namespace, a10)); + ref p1(to_python(a1, lookup_tag())); + ref p2(to_python(a2, lookup_tag())); + ref p3(to_python(a3, lookup_tag())); + ref p4(to_python(a4, lookup_tag())); + ref p5(to_python(a5, lookup_tag())); + ref p6(to_python(a6, lookup_tag())); + ref p7(to_python(a7, lookup_tag())); + ref p8(to_python(a8, lookup_tag())); + ref p9(to_python(a9, lookup_tag())); + ref p10(to_python(a10, lookup_tag())); ref result(PyEval_CallMethod(self, const_cast(name), const_cast("(OOOOOOOOOO)"), p1.get(), @@ -408,16 +408,16 @@ struct callback template static R call(PyObject* self, const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9, const A10& a10) { - ref p1(to_python(search_namespace, a1)); - ref p2(to_python(search_namespace, a2)); - ref p3(to_python(search_namespace, a3)); - ref p4(to_python(search_namespace, a4)); - ref p5(to_python(search_namespace, a5)); - ref p6(to_python(search_namespace, a6)); - ref p7(to_python(search_namespace, a7)); - ref p8(to_python(search_namespace, a8)); - ref p9(to_python(search_namespace, a9)); - ref p10(to_python(search_namespace, a10)); + ref p1(to_python(a1, lookup_tag())); + ref p2(to_python(a2, lookup_tag())); + ref p3(to_python(a3, lookup_tag())); + ref p4(to_python(a4, lookup_tag())); + ref p5(to_python(a5, lookup_tag())); + ref p6(to_python(a6, lookup_tag())); + ref p7(to_python(a7, lookup_tag())); + ref p8(to_python(a8, lookup_tag())); + ref p9(to_python(a9, lookup_tag())); + ref p10(to_python(a10, lookup_tag())); ref result(PyEval_CallFunction(self, const_cast("(OOOOOOOOOO)"), p1.get(), p2.get(), @@ -455,7 +455,7 @@ struct callback template static void call_method(PyObject* self, const char* name, const A1& a1) { - ref p1(to_python(search_namespace, a1)); + ref p1(to_python(a1, lookup_tag())); ref result(PyEval_CallMethod(self, const_cast(name), const_cast("(O)"), p1.get())); @@ -464,7 +464,7 @@ struct callback template static void call(PyObject* self, const A1& a1) { - ref p1(to_python(search_namespace, a1)); + ref p1(to_python(a1, lookup_tag())); ref result(PyEval_CallFunction(self, const_cast("(O)"), p1.get())); } @@ -472,8 +472,8 @@ struct callback template static void call_method(PyObject* self, const char* name, const A1& a1, const A2& a2) { - ref p1(to_python(search_namespace, a1)); - ref p2(to_python(search_namespace, a2)); + ref p1(to_python(a1, lookup_tag())); + ref p2(to_python(a2, lookup_tag())); ref result(PyEval_CallMethod(self, const_cast(name), const_cast("(OO)"), p1.get(), @@ -483,8 +483,8 @@ struct callback template static void call(PyObject* self, const A1& a1, const A2& a2) { - ref p1(to_python(search_namespace, a1)); - ref p2(to_python(search_namespace, a2)); + ref p1(to_python(a1, lookup_tag())); + ref p2(to_python(a2, lookup_tag())); ref result(PyEval_CallFunction(self, const_cast("(OO)"), p1.get(), p2.get())); @@ -493,9 +493,9 @@ struct callback template static void call_method(PyObject* self, const char* name, const A1& a1, const A2& a2, const A3& a3) { - ref p1(to_python(search_namespace, a1)); - ref p2(to_python(search_namespace, a2)); - ref p3(to_python(search_namespace, a3)); + ref p1(to_python(a1, lookup_tag())); + ref p2(to_python(a2, lookup_tag())); + ref p3(to_python(a3, lookup_tag())); ref result(PyEval_CallMethod(self, const_cast(name), const_cast("(OOO)"), p1.get(), @@ -506,9 +506,9 @@ struct callback template static void call(PyObject* self, const A1& a1, const A2& a2, const A3& a3) { - ref p1(to_python(search_namespace, a1)); - ref p2(to_python(search_namespace, a2)); - ref p3(to_python(search_namespace, a3)); + ref p1(to_python(a1, lookup_tag())); + ref p2(to_python(a2, lookup_tag())); + ref p3(to_python(a3, lookup_tag())); ref result(PyEval_CallFunction(self, const_cast("(OOO)"), p1.get(), p2.get(), @@ -518,10 +518,10 @@ struct callback template static void call_method(PyObject* self, const char* name, const A1& a1, const A2& a2, const A3& a3, const A4& a4) { - ref p1(to_python(search_namespace, a1)); - ref p2(to_python(search_namespace, a2)); - ref p3(to_python(search_namespace, a3)); - ref p4(to_python(search_namespace, a4)); + ref p1(to_python(a1, lookup_tag())); + ref p2(to_python(a2, lookup_tag())); + ref p3(to_python(a3, lookup_tag())); + ref p4(to_python(a4, lookup_tag())); ref result(PyEval_CallMethod(self, const_cast(name), const_cast("(OOOO)"), p1.get(), @@ -533,10 +533,10 @@ struct callback template static void call(PyObject* self, const A1& a1, const A2& a2, const A3& a3, const A4& a4) { - ref p1(to_python(search_namespace, a1)); - ref p2(to_python(search_namespace, a2)); - ref p3(to_python(search_namespace, a3)); - ref p4(to_python(search_namespace, a4)); + ref p1(to_python(a1, lookup_tag())); + ref p2(to_python(a2, lookup_tag())); + ref p3(to_python(a3, lookup_tag())); + ref p4(to_python(a4, lookup_tag())); ref result(PyEval_CallFunction(self, const_cast("(OOOO)"), p1.get(), p2.get(), @@ -547,11 +547,11 @@ struct callback template static void call_method(PyObject* self, const char* name, const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5) { - ref p1(to_python(search_namespace, a1)); - ref p2(to_python(search_namespace, a2)); - ref p3(to_python(search_namespace, a3)); - ref p4(to_python(search_namespace, a4)); - ref p5(to_python(search_namespace, a5)); + ref p1(to_python(a1, lookup_tag())); + ref p2(to_python(a2, lookup_tag())); + ref p3(to_python(a3, lookup_tag())); + ref p4(to_python(a4, lookup_tag())); + ref p5(to_python(a5, lookup_tag())); ref result(PyEval_CallMethod(self, const_cast(name), const_cast("(OOOOO)"), p1.get(), @@ -564,11 +564,11 @@ struct callback template static void call(PyObject* self, const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5) { - ref p1(to_python(search_namespace, a1)); - ref p2(to_python(search_namespace, a2)); - ref p3(to_python(search_namespace, a3)); - ref p4(to_python(search_namespace, a4)); - ref p5(to_python(search_namespace, a5)); + ref p1(to_python(a1, lookup_tag())); + ref p2(to_python(a2, lookup_tag())); + ref p3(to_python(a3, lookup_tag())); + ref p4(to_python(a4, lookup_tag())); + ref p5(to_python(a5, lookup_tag())); ref result(PyEval_CallFunction(self, const_cast("(OOOOO)"), p1.get(), p2.get(), @@ -580,12 +580,12 @@ struct callback template static void call_method(PyObject* self, const char* name, const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6) { - ref p1(to_python(search_namespace, a1)); - ref p2(to_python(search_namespace, a2)); - ref p3(to_python(search_namespace, a3)); - ref p4(to_python(search_namespace, a4)); - ref p5(to_python(search_namespace, a5)); - ref p6(to_python(search_namespace, a6)); + ref p1(to_python(a1, lookup_tag())); + ref p2(to_python(a2, lookup_tag())); + ref p3(to_python(a3, lookup_tag())); + ref p4(to_python(a4, lookup_tag())); + ref p5(to_python(a5, lookup_tag())); + ref p6(to_python(a6, lookup_tag())); ref result(PyEval_CallMethod(self, const_cast(name), const_cast("(OOOOOO)"), p1.get(), @@ -599,12 +599,12 @@ struct callback template static void call(PyObject* self, const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6) { - ref p1(to_python(search_namespace, a1)); - ref p2(to_python(search_namespace, a2)); - ref p3(to_python(search_namespace, a3)); - ref p4(to_python(search_namespace, a4)); - ref p5(to_python(search_namespace, a5)); - ref p6(to_python(search_namespace, a6)); + ref p1(to_python(a1, lookup_tag())); + ref p2(to_python(a2, lookup_tag())); + ref p3(to_python(a3, lookup_tag())); + ref p4(to_python(a4, lookup_tag())); + ref p5(to_python(a5, lookup_tag())); + ref p6(to_python(a6, lookup_tag())); ref result(PyEval_CallFunction(self, const_cast("(OOOOOO)"), p1.get(), p2.get(), @@ -617,13 +617,13 @@ struct callback template static void call_method(PyObject* self, const char* name, const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7) { - ref p1(to_python(search_namespace, a1)); - ref p2(to_python(search_namespace, a2)); - ref p3(to_python(search_namespace, a3)); - ref p4(to_python(search_namespace, a4)); - ref p5(to_python(search_namespace, a5)); - ref p6(to_python(search_namespace, a6)); - ref p7(to_python(search_namespace, a7)); + ref p1(to_python(a1, lookup_tag())); + ref p2(to_python(a2, lookup_tag())); + ref p3(to_python(a3, lookup_tag())); + ref p4(to_python(a4, lookup_tag())); + ref p5(to_python(a5, lookup_tag())); + ref p6(to_python(a6, lookup_tag())); + ref p7(to_python(a7, lookup_tag())); ref result(PyEval_CallMethod(self, const_cast(name), const_cast("(OOOOOOO)"), p1.get(), @@ -638,13 +638,13 @@ struct callback template static void call(PyObject* self, const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7) { - ref p1(to_python(search_namespace, a1)); - ref p2(to_python(search_namespace, a2)); - ref p3(to_python(search_namespace, a3)); - ref p4(to_python(search_namespace, a4)); - ref p5(to_python(search_namespace, a5)); - ref p6(to_python(search_namespace, a6)); - ref p7(to_python(search_namespace, a7)); + ref p1(to_python(a1, lookup_tag())); + ref p2(to_python(a2, lookup_tag())); + ref p3(to_python(a3, lookup_tag())); + ref p4(to_python(a4, lookup_tag())); + ref p5(to_python(a5, lookup_tag())); + ref p6(to_python(a6, lookup_tag())); + ref p7(to_python(a7, lookup_tag())); ref result(PyEval_CallFunction(self, const_cast("(OOOOOOO)"), p1.get(), p2.get(), @@ -658,14 +658,14 @@ struct callback template static void call_method(PyObject* self, const char* name, const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8) { - ref p1(to_python(search_namespace, a1)); - ref p2(to_python(search_namespace, a2)); - ref p3(to_python(search_namespace, a3)); - ref p4(to_python(search_namespace, a4)); - ref p5(to_python(search_namespace, a5)); - ref p6(to_python(search_namespace, a6)); - ref p7(to_python(search_namespace, a7)); - ref p8(to_python(search_namespace, a8)); + ref p1(to_python(a1, lookup_tag())); + ref p2(to_python(a2, lookup_tag())); + ref p3(to_python(a3, lookup_tag())); + ref p4(to_python(a4, lookup_tag())); + ref p5(to_python(a5, lookup_tag())); + ref p6(to_python(a6, lookup_tag())); + ref p7(to_python(a7, lookup_tag())); + ref p8(to_python(a8, lookup_tag())); ref result(PyEval_CallMethod(self, const_cast(name), const_cast("(OOOOOOOO)"), p1.get(), @@ -681,14 +681,14 @@ struct callback template static void call(PyObject* self, const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8) { - ref p1(to_python(search_namespace, a1)); - ref p2(to_python(search_namespace, a2)); - ref p3(to_python(search_namespace, a3)); - ref p4(to_python(search_namespace, a4)); - ref p5(to_python(search_namespace, a5)); - ref p6(to_python(search_namespace, a6)); - ref p7(to_python(search_namespace, a7)); - ref p8(to_python(search_namespace, a8)); + ref p1(to_python(a1, lookup_tag())); + ref p2(to_python(a2, lookup_tag())); + ref p3(to_python(a3, lookup_tag())); + ref p4(to_python(a4, lookup_tag())); + ref p5(to_python(a5, lookup_tag())); + ref p6(to_python(a6, lookup_tag())); + ref p7(to_python(a7, lookup_tag())); + ref p8(to_python(a8, lookup_tag())); ref result(PyEval_CallFunction(self, const_cast("(OOOOOOOO)"), p1.get(), p2.get(), @@ -703,15 +703,15 @@ struct callback template static void call_method(PyObject* self, const char* name, const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9) { - ref p1(to_python(search_namespace, a1)); - ref p2(to_python(search_namespace, a2)); - ref p3(to_python(search_namespace, a3)); - ref p4(to_python(search_namespace, a4)); - ref p5(to_python(search_namespace, a5)); - ref p6(to_python(search_namespace, a6)); - ref p7(to_python(search_namespace, a7)); - ref p8(to_python(search_namespace, a8)); - ref p9(to_python(search_namespace, a9)); + ref p1(to_python(a1, lookup_tag())); + ref p2(to_python(a2, lookup_tag())); + ref p3(to_python(a3, lookup_tag())); + ref p4(to_python(a4, lookup_tag())); + ref p5(to_python(a5, lookup_tag())); + ref p6(to_python(a6, lookup_tag())); + ref p7(to_python(a7, lookup_tag())); + ref p8(to_python(a8, lookup_tag())); + ref p9(to_python(a9, lookup_tag())); ref result(PyEval_CallMethod(self, const_cast(name), const_cast("(OOOOOOOOO)"), p1.get(), @@ -728,15 +728,15 @@ struct callback template static void call(PyObject* self, const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9) { - ref p1(to_python(search_namespace, a1)); - ref p2(to_python(search_namespace, a2)); - ref p3(to_python(search_namespace, a3)); - ref p4(to_python(search_namespace, a4)); - ref p5(to_python(search_namespace, a5)); - ref p6(to_python(search_namespace, a6)); - ref p7(to_python(search_namespace, a7)); - ref p8(to_python(search_namespace, a8)); - ref p9(to_python(search_namespace, a9)); + ref p1(to_python(a1, lookup_tag())); + ref p2(to_python(a2, lookup_tag())); + ref p3(to_python(a3, lookup_tag())); + ref p4(to_python(a4, lookup_tag())); + ref p5(to_python(a5, lookup_tag())); + ref p6(to_python(a6, lookup_tag())); + ref p7(to_python(a7, lookup_tag())); + ref p8(to_python(a8, lookup_tag())); + ref p9(to_python(a9, lookup_tag())); ref result(PyEval_CallFunction(self, const_cast("(OOOOOOOOO)"), p1.get(), p2.get(), @@ -752,16 +752,16 @@ struct callback template static void call_method(PyObject* self, const char* name, const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9, const A10& a10) { - ref p1(to_python(search_namespace, a1)); - ref p2(to_python(search_namespace, a2)); - ref p3(to_python(search_namespace, a3)); - ref p4(to_python(search_namespace, a4)); - ref p5(to_python(search_namespace, a5)); - ref p6(to_python(search_namespace, a6)); - ref p7(to_python(search_namespace, a7)); - ref p8(to_python(search_namespace, a8)); - ref p9(to_python(search_namespace, a9)); - ref p10(to_python(search_namespace, a10)); + ref p1(to_python(a1, lookup_tag())); + ref p2(to_python(a2, lookup_tag())); + ref p3(to_python(a3, lookup_tag())); + ref p4(to_python(a4, lookup_tag())); + ref p5(to_python(a5, lookup_tag())); + ref p6(to_python(a6, lookup_tag())); + ref p7(to_python(a7, lookup_tag())); + ref p8(to_python(a8, lookup_tag())); + ref p9(to_python(a9, lookup_tag())); + ref p10(to_python(a10, lookup_tag())); ref result(PyEval_CallMethod(self, const_cast(name), const_cast("(OOOOOOOOOO)"), p1.get(), @@ -779,16 +779,16 @@ struct callback template static void call(PyObject* self, const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9, const A10& a10) { - ref p1(to_python(search_namespace, a1)); - ref p2(to_python(search_namespace, a2)); - ref p3(to_python(search_namespace, a3)); - ref p4(to_python(search_namespace, a4)); - ref p5(to_python(search_namespace, a5)); - ref p6(to_python(search_namespace, a6)); - ref p7(to_python(search_namespace, a7)); - ref p8(to_python(search_namespace, a8)); - ref p9(to_python(search_namespace, a9)); - ref p10(to_python(search_namespace, a10)); + ref p1(to_python(a1, lookup_tag())); + ref p2(to_python(a2, lookup_tag())); + ref p3(to_python(a3, lookup_tag())); + ref p4(to_python(a4, lookup_tag())); + ref p5(to_python(a5, lookup_tag())); + ref p6(to_python(a6, lookup_tag())); + ref p7(to_python(a7, lookup_tag())); + ref p8(to_python(a8, lookup_tag())); + ref p9(to_python(a9, lookup_tag())); + ref p10(to_python(a10, lookup_tag())); ref result(PyEval_CallFunction(self, const_cast("(OOOOOOOOOO)"), p1.get(), p2.get(), diff --git a/include/boost/python/caller.hpp b/include/boost/python/caller.hpp index 86820233..828adff0 100644 --- a/include/boost/python/caller.hpp +++ b/include/boost/python/caller.hpp @@ -30,7 +30,7 @@ struct caller if (!PyArg_ParseTuple(args, const_cast("O"), &self)) return 0; T& target = from_python(self, type()); - return to_python(search_namespace, (target.*pmf)()); + return to_python((target.*pmf)(), lookup_tag()); } template @@ -40,7 +40,7 @@ struct caller if (!PyArg_ParseTuple(args, const_cast("OO"), &self, &a1)) return 0; T& target = from_python(self, type()); - return to_python(search_namespace, (target.*pmf)(from_python(a1, type()))); + return to_python((target.*pmf)(from_python(a1, type())), lookup_tag()); } template @@ -51,8 +51,8 @@ struct caller if (!PyArg_ParseTuple(args, const_cast("OOO"), &self, &a1, &a2)) return 0; T& target = from_python(self, type()); - return to_python(search_namespace, (target.*pmf)(from_python(a1, type()), - from_python(a2, type()))); + return to_python((target.*pmf)(from_python(a1, type()), + from_python(a2, type())), lookup_tag()); } template @@ -64,9 +64,9 @@ struct caller if (!PyArg_ParseTuple(args, const_cast("OOOO"), &self, &a1, &a2, &a3)) return 0; T& target = from_python(self, type()); - return to_python(search_namespace, (target.*pmf)(from_python(a1, type()), + return to_python((target.*pmf)(from_python(a1, type()), from_python(a2, type()), - from_python(a3, type()))); + from_python(a3, type())), lookup_tag()); } template @@ -79,10 +79,10 @@ struct caller if (!PyArg_ParseTuple(args, const_cast("OOOOO"), &self, &a1, &a2, &a3, &a4)) return 0; T& target = from_python(self, type()); - return to_python(search_namespace, (target.*pmf)(from_python(a1, type()), + return to_python((target.*pmf)(from_python(a1, type()), from_python(a2, type()), from_python(a3, type()), - from_python(a4, type()))); + from_python(a4, type())), lookup_tag()); } template @@ -96,11 +96,11 @@ struct caller if (!PyArg_ParseTuple(args, const_cast("OOOOOO"), &self, &a1, &a2, &a3, &a4, &a5)) return 0; T& target = from_python(self, type()); - return to_python(search_namespace, (target.*pmf)(from_python(a1, type()), + return to_python((target.*pmf)(from_python(a1, type()), from_python(a2, type()), from_python(a3, type()), from_python(a4, type()), - from_python(a5, type()))); + from_python(a5, type())), lookup_tag()); } template @@ -115,12 +115,12 @@ struct caller if (!PyArg_ParseTuple(args, const_cast("OOOOOOO"), &self, &a1, &a2, &a3, &a4, &a5, &a6)) return 0; T& target = from_python(self, type()); - return to_python(search_namespace, (target.*pmf)(from_python(a1, type()), + return to_python((target.*pmf)(from_python(a1, type()), from_python(a2, type()), from_python(a3, type()), from_python(a4, type()), from_python(a5, type()), - from_python(a6, type()))); + from_python(a6, type())), lookup_tag()); } template @@ -136,13 +136,13 @@ struct caller if (!PyArg_ParseTuple(args, const_cast("OOOOOOOO"), &self, &a1, &a2, &a3, &a4, &a5, &a6, &a7)) return 0; T& target = from_python(self, type()); - return to_python(search_namespace, (target.*pmf)(from_python(a1, type()), + return to_python((target.*pmf)(from_python(a1, type()), from_python(a2, type()), from_python(a3, type()), from_python(a4, type()), from_python(a5, type()), from_python(a6, type()), - from_python(a7, type()))); + from_python(a7, type())), lookup_tag()); } template @@ -159,14 +159,14 @@ struct caller if (!PyArg_ParseTuple(args, const_cast("OOOOOOOOO"), &self, &a1, &a2, &a3, &a4, &a5, &a6, &a7, &a8)) return 0; T& target = from_python(self, type()); - return to_python(search_namespace, (target.*pmf)(from_python(a1, type()), + return to_python((target.*pmf)(from_python(a1, type()), from_python(a2, type()), from_python(a3, type()), from_python(a4, type()), from_python(a5, type()), from_python(a6, type()), from_python(a7, type()), - from_python(a8, type()))); + from_python(a8, type())), lookup_tag()); } template @@ -184,7 +184,7 @@ struct caller if (!PyArg_ParseTuple(args, const_cast("OOOOOOOOOO"), &self, &a1, &a2, &a3, &a4, &a5, &a6, &a7, &a8, &a9)) return 0; T& target = from_python(self, type()); - return to_python(search_namespace, (target.*pmf)(from_python(a1, type()), + return to_python((target.*pmf)(from_python(a1, type()), from_python(a2, type()), from_python(a3, type()), from_python(a4, type()), @@ -192,7 +192,7 @@ struct caller from_python(a6, type()), from_python(a7, type()), from_python(a8, type()), - from_python(a9, type()))); + from_python(a9, type())), lookup_tag()); } template @@ -211,7 +211,7 @@ struct caller if (!PyArg_ParseTuple(args, const_cast("OOOOOOOOOOO"), &self, &a1, &a2, &a3, &a4, &a5, &a6, &a7, &a8, &a9, &a10)) return 0; T& target = from_python(self, type()); - return to_python(search_namespace, (target.*pmf)(from_python(a1, type()), + return to_python((target.*pmf)(from_python(a1, type()), from_python(a2, type()), from_python(a3, type()), from_python(a4, type()), @@ -220,7 +220,7 @@ struct caller from_python(a7, type()), from_python(a8, type()), from_python(a9, type()), - from_python(a10, type()))); + from_python(a10, type())), lookup_tag()); } @@ -230,7 +230,7 @@ struct caller if (!PyArg_ParseTuple(args, const_cast("O"), &self)) return 0; T& target = from_python(self, type()); - return to_python(search_namespace, (target.*pmf)()); + return to_python((target.*pmf)(), lookup_tag()); } template @@ -240,7 +240,7 @@ struct caller if (!PyArg_ParseTuple(args, const_cast("OO"), &self, &a1)) return 0; T& target = from_python(self, type()); - return to_python(search_namespace, (target.*pmf)(from_python(a1, type()))); + return to_python((target.*pmf)(from_python(a1, type())), lookup_tag()); } template @@ -251,8 +251,8 @@ struct caller if (!PyArg_ParseTuple(args, const_cast("OOO"), &self, &a1, &a2)) return 0; T& target = from_python(self, type()); - return to_python(search_namespace, (target.*pmf)(from_python(a1, type()), - from_python(a2, type()))); + return to_python((target.*pmf)(from_python(a1, type()), + from_python(a2, type())), lookup_tag()); } template @@ -264,9 +264,9 @@ struct caller if (!PyArg_ParseTuple(args, const_cast("OOOO"), &self, &a1, &a2, &a3)) return 0; T& target = from_python(self, type()); - return to_python(search_namespace, (target.*pmf)(from_python(a1, type()), + return to_python((target.*pmf)(from_python(a1, type()), from_python(a2, type()), - from_python(a3, type()))); + from_python(a3, type())), lookup_tag()); } template @@ -279,10 +279,10 @@ struct caller if (!PyArg_ParseTuple(args, const_cast("OOOOO"), &self, &a1, &a2, &a3, &a4)) return 0; T& target = from_python(self, type()); - return to_python(search_namespace, (target.*pmf)(from_python(a1, type()), + return to_python((target.*pmf)(from_python(a1, type()), from_python(a2, type()), from_python(a3, type()), - from_python(a4, type()))); + from_python(a4, type())), lookup_tag()); } template @@ -296,11 +296,11 @@ struct caller if (!PyArg_ParseTuple(args, const_cast("OOOOOO"), &self, &a1, &a2, &a3, &a4, &a5)) return 0; T& target = from_python(self, type()); - return to_python(search_namespace, (target.*pmf)(from_python(a1, type()), + return to_python((target.*pmf)(from_python(a1, type()), from_python(a2, type()), from_python(a3, type()), from_python(a4, type()), - from_python(a5, type()))); + from_python(a5, type())), lookup_tag()); } template @@ -315,12 +315,12 @@ struct caller if (!PyArg_ParseTuple(args, const_cast("OOOOOOO"), &self, &a1, &a2, &a3, &a4, &a5, &a6)) return 0; T& target = from_python(self, type()); - return to_python(search_namespace, (target.*pmf)(from_python(a1, type()), + return to_python((target.*pmf)(from_python(a1, type()), from_python(a2, type()), from_python(a3, type()), from_python(a4, type()), from_python(a5, type()), - from_python(a6, type()))); + from_python(a6, type())), lookup_tag()); } template @@ -336,13 +336,13 @@ struct caller if (!PyArg_ParseTuple(args, const_cast("OOOOOOOO"), &self, &a1, &a2, &a3, &a4, &a5, &a6, &a7)) return 0; T& target = from_python(self, type()); - return to_python(search_namespace, (target.*pmf)(from_python(a1, type()), + return to_python((target.*pmf)(from_python(a1, type()), from_python(a2, type()), from_python(a3, type()), from_python(a4, type()), from_python(a5, type()), from_python(a6, type()), - from_python(a7, type()))); + from_python(a7, type())), lookup_tag()); } template @@ -359,14 +359,14 @@ struct caller if (!PyArg_ParseTuple(args, const_cast("OOOOOOOOO"), &self, &a1, &a2, &a3, &a4, &a5, &a6, &a7, &a8)) return 0; T& target = from_python(self, type()); - return to_python(search_namespace, (target.*pmf)(from_python(a1, type()), + return to_python((target.*pmf)(from_python(a1, type()), from_python(a2, type()), from_python(a3, type()), from_python(a4, type()), from_python(a5, type()), from_python(a6, type()), from_python(a7, type()), - from_python(a8, type()))); + from_python(a8, type())), lookup_tag()); } template @@ -384,7 +384,7 @@ struct caller if (!PyArg_ParseTuple(args, const_cast("OOOOOOOOOO"), &self, &a1, &a2, &a3, &a4, &a5, &a6, &a7, &a8, &a9)) return 0; T& target = from_python(self, type()); - return to_python(search_namespace, (target.*pmf)(from_python(a1, type()), + return to_python((target.*pmf)(from_python(a1, type()), from_python(a2, type()), from_python(a3, type()), from_python(a4, type()), @@ -392,7 +392,7 @@ struct caller from_python(a6, type()), from_python(a7, type()), from_python(a8, type()), - from_python(a9, type()))); + from_python(a9, type())), lookup_tag()); } template @@ -411,7 +411,7 @@ struct caller if (!PyArg_ParseTuple(args, const_cast("OOOOOOOOOOO"), &self, &a1, &a2, &a3, &a4, &a5, &a6, &a7, &a8, &a9, &a10)) return 0; T& target = from_python(self, type()); - return to_python(search_namespace, (target.*pmf)(from_python(a1, type()), + return to_python((target.*pmf)(from_python(a1, type()), from_python(a2, type()), from_python(a3, type()), from_python(a4, type()), @@ -420,14 +420,14 @@ struct caller from_python(a7, type()), from_python(a8, type()), from_python(a9, type()), - from_python(a10, type()))); + from_python(a10, type())), lookup_tag()); } // Free functions static PyObject* call(R (*f)(), PyObject* args, PyObject* /* keywords */ ) { if (!PyArg_ParseTuple(args, const_cast(""))) return 0; - return to_python(search_namespace, f()); + return to_python(f(), lookup_tag()); } template @@ -435,7 +435,7 @@ struct caller PyObject* a1; if (!PyArg_ParseTuple(args, const_cast("O"), &a1)) return 0; - return to_python(search_namespace, f(from_python(a1, type()))); + return to_python(f(from_python(a1, type())), lookup_tag()); } template @@ -444,8 +444,8 @@ struct caller PyObject* a2; if (!PyArg_ParseTuple(args, const_cast("OO"), &a1, &a2)) return 0; - return to_python(search_namespace, f(from_python(a1, type()), - from_python(a2, type()))); + return to_python(f(from_python(a1, type()), + from_python(a2, type())), lookup_tag()); } template @@ -455,9 +455,9 @@ struct caller PyObject* a3; if (!PyArg_ParseTuple(args, const_cast("OOO"), &a1, &a2, &a3)) return 0; - return to_python(search_namespace, f(from_python(a1, type()), + return to_python(f(from_python(a1, type()), from_python(a2, type()), - from_python(a3, type()))); + from_python(a3, type())), lookup_tag()); } template @@ -468,10 +468,10 @@ struct caller PyObject* a4; if (!PyArg_ParseTuple(args, const_cast("OOOO"), &a1, &a2, &a3, &a4)) return 0; - return to_python(search_namespace, f(from_python(a1, type()), + return to_python(f(from_python(a1, type()), from_python(a2, type()), from_python(a3, type()), - from_python(a4, type()))); + from_python(a4, type())), lookup_tag()); } template @@ -483,11 +483,11 @@ struct caller PyObject* a5; if (!PyArg_ParseTuple(args, const_cast("OOOOO"), &a1, &a2, &a3, &a4, &a5)) return 0; - return to_python(search_namespace, f(from_python(a1, type()), + return to_python(f(from_python(a1, type()), from_python(a2, type()), from_python(a3, type()), from_python(a4, type()), - from_python(a5, type()))); + from_python(a5, type())), lookup_tag()); } template @@ -500,12 +500,12 @@ struct caller PyObject* a6; if (!PyArg_ParseTuple(args, const_cast("OOOOOO"), &a1, &a2, &a3, &a4, &a5, &a6)) return 0; - return to_python(search_namespace, f(from_python(a1, type()), + return to_python(f(from_python(a1, type()), from_python(a2, type()), from_python(a3, type()), from_python(a4, type()), from_python(a5, type()), - from_python(a6, type()))); + from_python(a6, type())), lookup_tag()); } template @@ -519,13 +519,13 @@ struct caller PyObject* a7; if (!PyArg_ParseTuple(args, const_cast("OOOOOOO"), &a1, &a2, &a3, &a4, &a5, &a6, &a7)) return 0; - return to_python(search_namespace, f(from_python(a1, type()), + return to_python(f(from_python(a1, type()), from_python(a2, type()), from_python(a3, type()), from_python(a4, type()), from_python(a5, type()), from_python(a6, type()), - from_python(a7, type()))); + from_python(a7, type())), lookup_tag()); } template @@ -540,14 +540,14 @@ struct caller PyObject* a8; if (!PyArg_ParseTuple(args, const_cast("OOOOOOOO"), &a1, &a2, &a3, &a4, &a5, &a6, &a7, &a8)) return 0; - return to_python(search_namespace, f(from_python(a1, type()), + return to_python(f(from_python(a1, type()), from_python(a2, type()), from_python(a3, type()), from_python(a4, type()), from_python(a5, type()), from_python(a6, type()), from_python(a7, type()), - from_python(a8, type()))); + from_python(a8, type())), lookup_tag()); } template @@ -563,7 +563,7 @@ struct caller PyObject* a9; if (!PyArg_ParseTuple(args, const_cast("OOOOOOOOO"), &a1, &a2, &a3, &a4, &a5, &a6, &a7, &a8, &a9)) return 0; - return to_python(search_namespace, f(from_python(a1, type()), + return to_python(f(from_python(a1, type()), from_python(a2, type()), from_python(a3, type()), from_python(a4, type()), @@ -571,7 +571,7 @@ struct caller from_python(a6, type()), from_python(a7, type()), from_python(a8, type()), - from_python(a9, type()))); + from_python(a9, type())), lookup_tag()); } template @@ -588,7 +588,7 @@ struct caller PyObject* a10; if (!PyArg_ParseTuple(args, const_cast("OOOOOOOOOO"), &a1, &a2, &a3, &a4, &a5, &a6, &a7, &a8, &a9, &a10)) return 0; - return to_python(search_namespace, f(from_python(a1, type()), + return to_python(f(from_python(a1, type()), from_python(a2, type()), from_python(a3, type()), from_python(a4, type()), @@ -597,7 +597,7 @@ struct caller from_python(a7, type()), from_python(a8, type()), from_python(a9, type()), - from_python(a10, type()))); + from_python(a10, type())), lookup_tag()); } template @@ -615,7 +615,7 @@ struct caller PyObject* a11; if (!PyArg_ParseTuple(args, const_cast("OOOOOOOOOOO"), &a1, &a2, &a3, &a4, &a5, &a6, &a7, &a8, &a9, &a10, &a11)) return 0; - return to_python(search_namespace, f(from_python(a1, type()), + return to_python(f(from_python(a1, type()), from_python(a2, type()), from_python(a3, type()), from_python(a4, type()), @@ -625,7 +625,7 @@ struct caller from_python(a8, type()), from_python(a9, type()), from_python(a10, type()), - from_python(a11, type()))); + from_python(a11, type())), lookup_tag()); } }; diff --git a/include/boost/python/class_builder.hpp b/include/boost/python/class_builder.hpp index a4ed33e9..1cb258f8 100644 --- a/include/boost/python/class_builder.hpp +++ b/include/boost/python/class_builder.hpp @@ -29,11 +29,11 @@ class class_builder /// Tell Boost.Python that for the purposes of pickling, the state is /// completely captured in the object's __dict__. inline void dict_defines_state() { - add(ref(to_python(search_namespace, 1)), "__dict_defines_state__"); + add(ref(to_python(1, lookup_tag())), "__dict_defines_state__"); } inline void getstate_manages_dict() { - add(ref(to_python(search_namespace, 1)), "__getstate_manages_dict__"); + add(ref(to_python(1, lookup_tag())), "__getstate_manages_dict__"); } /// define constructors diff --git a/include/boost/python/classes.hpp b/include/boost/python/classes.hpp index 688b0bef..d165f51a 100644 --- a/include/boost/python/classes.hpp +++ b/include/boost/python/classes.hpp @@ -284,14 +284,14 @@ PyObject* class_t::instance_mapping_subscript(PyObject* obj, PyObject* key) c template PyObject* class_t::instance_sequence_item(PyObject* obj, int n) const { - ref key(to_python(search_namespace, n)); + ref key(to_python(n, lookup_tag())); return downcast(obj)->get_subscript(key.get()); } template int class_t::instance_sequence_ass_item(PyObject* obj, int n, PyObject* value) const { - ref key(to_python(search_namespace, n)); + ref key(to_python(n, lookup_tag())); downcast(obj)->set_subscript(key.get(), value); return 0; } diff --git a/include/boost/python/conversions.hpp b/include/boost/python/conversions.hpp index 45304082..015fbaab 100644 --- a/include/boost/python/conversions.hpp +++ b/include/boost/python/conversions.hpp @@ -34,7 +34,7 @@ # endif namespace boost { namespace python { - enum semantics { search_namespace }; // Used to find to_python functions via koenig lookup. + struct lookup_tag {}; // Used to find to_python functions via Koenig lookup. }} BOOST_PYTHON_BEGIN_CONVERSION_NAMESPACE // this is a gcc 2.95.2 bug workaround @@ -56,9 +56,9 @@ class py_enum_as_int_converters from_python(x, boost::python::type())); } - friend PyObject* to_python(boost::python::semantics, EnumType x) + friend PyObject* to_python(EnumType x, boost::python::lookup_tag) { - return to_python(boost::python::search_namespace, static_cast(x)); + return to_python(static_cast(x), boost::python::lookup_tag()); } }; BOOST_PYTHON_END_CONVERSION_NAMESPACE @@ -120,70 +120,70 @@ BOOST_PYTHON_BEGIN_CONVERSION_NAMESPACE // // Converters // -PyObject* to_python(boost::python::semantics, long); +PyObject* to_python(long, boost::python::lookup_tag); long from_python(PyObject* p, boost::python::type); long from_python(PyObject* p, boost::python::type); -PyObject* to_python(boost::python::semantics, unsigned long); +PyObject* to_python(unsigned long, boost::python::lookup_tag); unsigned long from_python(PyObject* p, boost::python::type); unsigned long from_python(PyObject* p, boost::python::type); -PyObject* to_python(boost::python::semantics, int); +PyObject* to_python(int, boost::python::lookup_tag); int from_python(PyObject*, boost::python::type); int from_python(PyObject*, boost::python::type); -PyObject* to_python(boost::python::semantics, unsigned int); +PyObject* to_python(unsigned int, boost::python::lookup_tag); unsigned int from_python(PyObject*, boost::python::type); unsigned int from_python(PyObject*, boost::python::type); -PyObject* to_python(boost::python::semantics, short); +PyObject* to_python(short, boost::python::lookup_tag); short from_python(PyObject*, boost::python::type); short from_python(PyObject*, boost::python::type); -PyObject* to_python(boost::python::semantics, unsigned short); +PyObject* to_python(unsigned short, boost::python::lookup_tag); unsigned short from_python(PyObject*, boost::python::type); unsigned short from_python(PyObject*, boost::python::type); -PyObject* to_python(boost::python::semantics, char); +PyObject* to_python(char, boost::python::lookup_tag); char from_python(PyObject*, boost::python::type); char from_python(PyObject*, boost::python::type); -PyObject* to_python(boost::python::semantics, signed char); +PyObject* to_python(signed char, boost::python::lookup_tag); signed char from_python(PyObject*, boost::python::type); signed char from_python(PyObject*, boost::python::type); -PyObject* to_python(boost::python::semantics, unsigned char); +PyObject* to_python(unsigned char, boost::python::lookup_tag); unsigned char from_python(PyObject*, boost::python::type); unsigned char from_python(PyObject*, boost::python::type); -PyObject* to_python(boost::python::semantics, float); +PyObject* to_python(float, boost::python::lookup_tag); float from_python(PyObject*, boost::python::type); float from_python(PyObject*, boost::python::type); -PyObject* to_python(boost::python::semantics, double); +PyObject* to_python(double, boost::python::lookup_tag); double from_python(PyObject*, boost::python::type); double from_python(PyObject*, boost::python::type); -PyObject* to_python(boost::python::semantics, bool); +PyObject* to_python(bool, boost::python::lookup_tag); bool from_python(PyObject*, boost::python::type); bool from_python(PyObject*, boost::python::type); -PyObject* to_python(boost::python::semantics); +PyObject* to_python(boost::python::lookup_tag); void from_python(PyObject*, boost::python::type); -PyObject* to_python(boost::python::semantics, const char* s); +PyObject* to_python(const char* s, boost::python::lookup_tag); const char* from_python(PyObject*, boost::python::type); -PyObject* to_python(boost::python::semantics, const std::string& s); +PyObject* to_python(const std::string& s, boost::python::lookup_tag); std::string from_python(PyObject*, boost::python::type); std::string from_python(PyObject*, boost::python::type); -inline PyObject* to_python(boost::python::semantics, const std::complex& x) +inline PyObject* to_python(const std::complex& x, boost::python::lookup_tag) { return boost::python::detail::complex_to_python(x); } -inline PyObject* to_python(boost::python::semantics, const std::complex& x) +inline PyObject* to_python(const std::complex& x, boost::python::lookup_tag) { return boost::python::detail::complex_to_python(x); } @@ -209,7 +209,7 @@ inline std::complex from_python(PyObject* p, } // For when your C++ function really wants to pass/return a PyObject* -PyObject* to_python(boost::python::semantics, PyObject*); +PyObject* to_python(PyObject*, boost::python::lookup_tag); PyObject* from_python(PyObject*, boost::python::type); // Some standard conversions to/from smart pointer types. You can add your own @@ -263,13 +263,13 @@ boost::shared_ptr from_python(PyObject*p, boost::python::type -PyObject* to_python(boost::python::semantics, std::auto_ptr p) +PyObject* to_python(std::auto_ptr p, boost::python::lookup_tag) { return new boost::python::wrapped_pointer, T>(p); } template -PyObject* to_python(boost::python::semantics, boost::shared_ptr p) +PyObject* to_python(boost::shared_ptr p, boost::python::lookup_tag) { return new boost::python::wrapped_pointer, T>(p); } @@ -280,43 +280,43 @@ PyObject* to_python(boost::python::semantics, boost::shared_ptr p) // #ifndef BOOST_MSVC6_OR_EARLIER -inline PyObject* to_python(boost::python::semantics, double d) +inline PyObject* to_python(double d, boost::python::lookup_tag) { return PyFloat_FromDouble(d); } -inline PyObject* to_python(boost::python::semantics, float f) +inline PyObject* to_python(float f, boost::python::lookup_tag) { return PyFloat_FromDouble(f); } #endif // BOOST_MSVC6_OR_EARLIER -inline PyObject* to_python(boost::python::semantics, long l) +inline PyObject* to_python(long l, boost::python::lookup_tag) { return PyInt_FromLong(l); } -inline PyObject* to_python(boost::python::semantics, int x) +inline PyObject* to_python(int x, boost::python::lookup_tag) { return PyInt_FromLong(x); } -inline PyObject* to_python(boost::python::semantics, short x) +inline PyObject* to_python(short x, boost::python::lookup_tag) { return PyInt_FromLong(x); } -inline PyObject* to_python(boost::python::semantics, bool b) +inline PyObject* to_python(bool b, boost::python::lookup_tag) { return PyInt_FromLong(b); } -inline PyObject* to_python(boost::python::semantics) +inline PyObject* to_python(boost::python::lookup_tag) { return boost::python::detail::none(); } -inline PyObject* to_python(boost::python::semantics, const char* s) +inline PyObject* to_python(const char* s, boost::python::lookup_tag) { return PyString_FromString(s); } @@ -326,7 +326,7 @@ inline std::string from_python(PyObject* p, boost::python::type()); } -inline PyObject* to_python(boost::python::semantics, PyObject* p) +inline PyObject* to_python(PyObject* p, boost::python::lookup_tag) { Py_INCREF(p); return p; diff --git a/include/boost/python/cross_module.hpp b/include/boost/python/cross_module.hpp index be0320f5..5db303dd 100644 --- a/include/boost/python/cross_module.hpp +++ b/include/boost/python/cross_module.hpp @@ -101,7 +101,7 @@ class python_import_extension_class_converters friend const std::auto_ptr& from_python(PyObject* p, boost::python::type&> t, bool sig = false) { return boost::python::detail::import_extension_class::get_converters()->from_python_caTr(p, t); } - friend PyObject* to_python(boost::python::semantics, std::auto_ptr x, bool sig = false) { + friend PyObject* to_python(std::auto_ptr x, boost::python::lookup_tag, bool sig = false) { return boost::python::detail::import_extension_class::get_converters()->dispatcher_to_python(x); } @@ -114,7 +114,7 @@ class python_import_extension_class_converters friend const boost::shared_ptr& from_python(PyObject* p, boost::python::type&> t, bool sig = false) { return boost::python::detail::import_extension_class::get_converters()->from_python_csTr(p, t); } - friend PyObject* to_python(boost::python::semantics, boost::shared_ptr x, bool sig = false) { + friend PyObject* to_python(boost::shared_ptr x, boost::python::lookup_tag, bool sig = false) { return boost::python::detail::import_extension_class::get_converters()->dispatcher_to_python(x); } }; @@ -165,7 +165,7 @@ struct export_converter_object_noncopyable : export_converter_object_base { virtual PyObject* dispatcher_to_python(const T& x) { PyErr_SetString(PyExc_RuntimeError, - "to_python(boost::python::semantics, const T&) converter not exported"); + "to_python(const T&, boost::python::lookup_tag) converter not exported"); throw import_error(); } @@ -201,7 +201,7 @@ struct export_converter_object_noncopyable : export_converter_object_base return from_python(p, t); } virtual PyObject* dispatcher_to_python(std::auto_ptr x) { - return to_python(search_namespace, x); + return to_python(x, lookup_tag()); } virtual boost::shared_ptr& from_python_sTr(PyObject* p, type&> t) { @@ -214,7 +214,7 @@ struct export_converter_object_noncopyable : export_converter_object_base return from_python(p, t); } virtual PyObject* dispatcher_to_python(boost::shared_ptr x) { - return to_python(search_namespace, x); + return to_python(x, lookup_tag()); } }; diff --git a/include/boost/python/detail/extension_class.hpp b/include/boost/python/detail/extension_class.hpp index 6471a587..c64f0112 100644 --- a/include/boost/python/detail/extension_class.hpp +++ b/include/boost/python/detail/extension_class.hpp @@ -182,7 +182,7 @@ class python_extension_class_converters /// Get an object which can be used to convert T to/from python. This is used /// as a kind of concept check by the free template function /// - /// PyObject* to_python(boost::python::semantics, const T& x) + /// PyObject* to_python(const T& x, boost::python::lookup_tag) /// /// below this class, to prevent the confusing messages that would otherwise /// pop up. Now, if T hasn't been wrapped as an extension class, the user @@ -200,7 +200,7 @@ class python_extension_class_converters /// a compiler error. Instead, we access this function through the global /// template /// - /// PyObject* to_python(boost::python::semantics, const T& x) + /// PyObject* to_python(const T& x, boost::python::lookup_tag) /// /// defined below this class. Since template functions are instantiated only /// on demand, errors will be avoided unless T is noncopyable and the user @@ -341,7 +341,7 @@ class python_extension_class_converters friend const std::auto_ptr& from_python(PyObject* p, boost::python::type&>) { return smart_ptr_value(p, boost::python::type >()); } - friend PyObject* to_python(boost::python::semantics, std::auto_ptr x) + friend PyObject* to_python(std::auto_ptr x, boost::python::lookup_tag) { return smart_ptr_to_python(x); } friend boost::shared_ptr& from_python(PyObject* p, boost::python::type&>) @@ -353,7 +353,7 @@ class python_extension_class_converters friend const boost::shared_ptr& from_python(PyObject* p, boost::python::type&>) { return smart_ptr_value(p, boost::python::type >()); } - friend PyObject* to_python(boost::python::semantics, boost::shared_ptr x) + friend PyObject* to_python(boost::shared_ptr x, boost::python::lookup_tag) { return smart_ptr_to_python(x); } }; @@ -362,7 +362,7 @@ class python_extension_class_converters // T is a wrapped class. See the first 2 functions declared in // python_extension_class_converters above for more info. template -PyObject* to_python(boost::python::semantics, const T& x) +PyObject* to_python(const T& x, boost::python::lookup_tag) { return py_extension_class_converters(boost::python::type()).m_to_python(x); } diff --git a/include/boost/python/detail/functions.hpp b/include/boost/python/detail/functions.hpp index 5c68e85d..f58a3211 100644 --- a/include/boost/python/detail/functions.hpp +++ b/include/boost/python/detail/functions.hpp @@ -94,9 +94,10 @@ struct raw_arguments_function : function ref(keywords, ref::increment_count) : ref(PyDict_New())); - return to_python(search_namespace, + return to_python( (*m_pf)(from_python(args, type()), - from_python(dict.get(), type()))); + from_python(dict.get(), type())), + lookup_tag()); } const char* description() const @@ -263,8 +264,8 @@ PyObject* getter_function::do_call( if (!PyArg_ParseTuple(args, const_cast("O"), &self)) return 0; - return to_python(search_namespace, - from_python(self, type())->*m_pm); + return to_python(from_python(self, type())->*m_pm, + lookup_tag()); } template diff --git a/include/boost/python/objects.hpp b/include/boost/python/objects.hpp index 5a146781..cbabef69 100644 --- a/include/boost/python/objects.hpp +++ b/include/boost/python/objects.hpp @@ -297,7 +297,7 @@ struct list::slice_proxy BOOST_PYTHON_BEGIN_CONVERSION_NAMESPACE -PyObject* to_python(boost::python::semantics, const boost::python::tuple&); +PyObject* to_python(const boost::python::tuple&, boost::python::lookup_tag); boost::python::tuple from_python(PyObject* p, boost::python::type); inline boost::python::tuple from_python(PyObject* p, boost::python::type) @@ -305,7 +305,7 @@ inline boost::python::tuple from_python(PyObject* p, boost::python::type()); } -PyObject* to_python(boost::python::semantics, const boost::python::list&); +PyObject* to_python(const boost::python::list&, boost::python::lookup_tag); boost::python::list from_python(PyObject* p, boost::python::type); inline boost::python::list from_python(PyObject* p, boost::python::type) @@ -313,7 +313,7 @@ inline boost::python::list from_python(PyObject* p, boost::python::type()); } -PyObject* to_python(boost::python::semantics, const boost::python::string&); +PyObject* to_python(const boost::python::string&, boost::python::lookup_tag); boost::python::string from_python(PyObject* p, boost::python::type); inline boost::python::string from_python(PyObject* p, boost::python::type) @@ -321,7 +321,7 @@ inline boost::python::string from_python(PyObject* p, boost::python::type()); } -PyObject* to_python(boost::python::semantics, const boost::python::dictionary&); +PyObject* to_python(const boost::python::dictionary&, boost::python::lookup_tag); boost::python::dictionary from_python(PyObject* p, boost::python::type); inline boost::python::dictionary from_python(PyObject* p, boost::python::type) diff --git a/include/boost/python/operators.hpp b/include/boost/python/operators.hpp index b4eaf1fa..16bb8f00 100644 --- a/include/boost/python/operators.hpp +++ b/include/boost/python/operators.hpp @@ -239,9 +239,9 @@ namespace detail { \ tuple args(ref(arguments, ref::increment_count)); \ \ - return to_python(search_namespace, \ + return to_python( \ from_python(args[0].get(), type()) oper \ - from_python(args[1].get(), type())); \ + from_python(args[1].get(), type()), lookup_tag()); \ } \ \ const char* description() const \ @@ -255,9 +255,9 @@ namespace detail { \ tuple args(ref(arguments, ref::increment_count)); \ \ - return to_python(search_namespace, \ + return to_python( \ from_python(args[1].get(), type()) oper \ - from_python(args[0].get(), type())); \ + from_python(args[0].get(), type()), lookup_tag()); \ } \ \ const char* description() const \ @@ -280,8 +280,8 @@ namespace detail { \ tuple args(ref(arguments, ref::increment_count)); \ \ - return to_python(search_namespace, \ - oper(from_python(args[0].get(), type()))); \ + return to_python( \ + oper(from_python(args[0].get(), type())), lookup_tag()); \ } \ \ const char* description() const \ @@ -335,9 +335,9 @@ namespace detail throw argument_error(); } - return to_python(search_namespace, + return to_python( pow(from_python(args[0].get(), type()), - from_python(args[1].get(), type()))); + from_python(args[1].get(), type())), lookup_tag()); } const char* description() const @@ -358,9 +358,9 @@ namespace detail throw argument_error(); } - return to_python(search_namespace, + return to_python( pow(from_python(args[1].get(), type()), - from_python(args[0].get(), type()))); + from_python(args[0].get(), type())), lookup_tag()); } const char* description() const @@ -386,13 +386,11 @@ namespace detail PyObject * res = PyTuple_New(2); PyTuple_SET_ITEM(res, 0, - to_python(search_namespace, - from_python(args[0].get(), type()) / - from_python(args[1].get(), type()))); + to_python(from_python(args[0].get(), type()) / + from_python(args[1].get(), type()), lookup_tag())); PyTuple_SET_ITEM(res, 1, - to_python(search_namespace, - from_python(args[0].get(), type()) % - from_python(args[1].get(), type()))); + to_python(from_python(args[0].get(), type()) % + from_python(args[1].get(), type()), lookup_tag())); return res; } @@ -411,13 +409,11 @@ namespace detail PyObject * res = PyTuple_New(2); PyTuple_SET_ITEM(res, 0, - to_python(search_namespace, - from_python(args[1].get(), type()) / - from_python(args[0].get(), type()))); + to_python(from_python(args[1].get(), type()) / + from_python(args[0].get(), type()), lookup_tag())); PyTuple_SET_ITEM(res, 1, - to_python(search_namespace, - from_python(args[1].get(), type()) % - from_python(args[0].get(), type()))); + to_python(from_python(args[1].get(), type()) % + from_python(args[0].get(), type()), lookup_tag())); return res; } @@ -443,14 +439,14 @@ namespace detail { tuple args(ref(arguments, ref::increment_count)); - return to_python(search_namespace, + return to_python( (from_python(args[0].get(), type()) < from_python(args[1].get(), type())) ? - 1 : (from_python(args[1].get(), type()) < from_python(args[0].get(), type())) ? 1 : - 0) ; + 0, lookup_tag()) ; } const char* description() const @@ -465,14 +461,14 @@ namespace detail { tuple args(ref(arguments, ref::increment_count)); - return to_python(search_namespace, + return to_python( (from_python(args[1].get(), type()) < from_python(args[0].get(), type())) ? - 1 : (from_python(args[0].get(), type()) < from_python(args[1].get(), type())) ? 1 : - 0) ; + 0, lookup_tag()) ; } const char* description() const @@ -511,12 +507,12 @@ namespace detail # ifdef BOOST_PYTHON_USE_SSTREAM std::ostringstream s; s << from_python(args[0].get(), type()); - return to_python(search_namespace, s.str()); + return to_python(s.str(), lookup_tag()); # else std::ostrstream s; s << from_python(args[0].get(), type()) << char(); auto unfreezer unfreeze(s); - return to_python(search_namespace, const_cast(s.str())); + return to_python(const_cast(s.str()), lookup_tag()); # endif } diff --git a/include/boost/python/reference.hpp b/include/boost/python/reference.hpp index 10d1412d..59464848 100644 --- a/include/boost/python/reference.hpp +++ b/include/boost/python/reference.hpp @@ -29,7 +29,7 @@ struct py_ptr_conversions : Base inline friend T from_python(PyObject* x, boost::python::type) { return T(boost::python::downcast(x).get(), T::increment_count); } - inline friend PyObject* to_python(boost::python::semantics, T x) + inline friend PyObject* to_python(T x, boost::python::lookup_tag) { return boost::python::as_object(x.release()); } }; @@ -163,7 +163,7 @@ typedef reference ref; template ref make_ref(const T& x) { - return ref(to_python(search_namespace, x)); + return ref(to_python(x, lookup_tag())); } }} // namespace boost::python diff --git a/src/conversions.cpp b/src/conversions.cpp index ed0e88e7..e6c470d8 100644 --- a/src/conversions.cpp +++ b/src/conversions.cpp @@ -142,7 +142,7 @@ PyObject* integer_to_python(T value) throw boost::python::error_already_set(); } - return to_python(boost::python::search_namespace, value_as_long); + return to_python(value_as_long, boost::python::lookup_tag()); } int from_python(PyObject* p, boost::python::type type) @@ -150,7 +150,7 @@ int from_python(PyObject* p, boost::python::type type) return integer_from_python(p, type); } -PyObject* to_python(boost::python::semantics, unsigned int i) +PyObject* to_python(unsigned int i, boost::python::lookup_tag) { return integer_to_python(i); } @@ -170,7 +170,7 @@ float from_python(PyObject* p, boost::python::type) return static_cast(from_python(p, boost::python::type())); } -PyObject* to_python(boost::python::semantics, unsigned short i) +PyObject* to_python(unsigned short i, boost::python::lookup_tag) { return integer_to_python(i); } @@ -180,7 +180,7 @@ unsigned short from_python(PyObject* p, boost::python::type type return integer_from_python(p, type); } -PyObject* to_python(boost::python::semantics, char c) +PyObject* to_python(char c, boost::python::lookup_tag) { if (c == '\0') return PyString_FromString(""); return PyString_FromStringAndSize(&c, 1); @@ -198,7 +198,7 @@ char from_python(PyObject* p, boost::python::type) return PyString_AsString(p)[0]; } -PyObject* to_python(boost::python::semantics, unsigned char i) +PyObject* to_python(unsigned char i, boost::python::lookup_tag) { return integer_to_python(i); } @@ -208,7 +208,7 @@ unsigned char from_python(PyObject* p, boost::python::type type) return integer_from_python(p, type); } -PyObject* to_python(boost::python::semantics, signed char i) +PyObject* to_python(signed char i, boost::python::lookup_tag) { return integer_to_python(i); } @@ -218,7 +218,7 @@ signed char from_python(PyObject* p, boost::python::type type) return integer_from_python(p, type); } -PyObject* to_python(boost::python::semantics, unsigned long x) +PyObject* to_python(unsigned long x, boost::python::lookup_tag) { return integer_to_python(x); } @@ -244,7 +244,7 @@ const char* from_python(PyObject* p, boost::python::type) return s; } -PyObject* to_python(boost::python::semantics, const std::string& s) +PyObject* to_python(const std::string& s, boost::python::lookup_tag) { return PyString_FromStringAndSize(s.data(), s.size()); } @@ -268,12 +268,12 @@ bool from_python(PyObject* p, boost::python::type) #ifdef BOOST_MSVC6_OR_EARLIER // An optimizer bug prevents these from being inlined. -PyObject* to_python(boost::python::semantics, double d) +PyObject* to_python(double d, boost::python::lookup_tag) { return PyFloat_FromDouble(d); } -PyObject* to_python(boost::python::semantics, float f) +PyObject* to_python(float f, boost::python::lookup_tag) { return PyFloat_FromDouble(f); } diff --git a/src/extension_class.cpp b/src/extension_class.cpp index dfdf1101..0eee81c9 100644 --- a/src/extension_class.cpp +++ b/src/extension_class.cpp @@ -42,7 +42,7 @@ namespace detail { BOOST_PYTHON_BEGIN_CONVERSION_NAMESPACE -inline PyObject* to_python(boost::python::semantics, boost::python::detail::operator_dispatcher* n) { return n; } +inline PyObject* to_python(boost::python::detail::operator_dispatcher* n, boost::python::lookup_tag) { return n; } BOOST_PYTHON_END_CONVERSION_NAMESPACE diff --git a/src/gen_callback.py b/src/gen_callback.py index 4a68e6bf..2981b09c 100644 --- a/src/gen_callback.py +++ b/src/gen_callback.py @@ -38,7 +38,7 @@ struct callback %{ template <%(class A%n%:, %)> %} static R call_method(PyObject* self, const char* name%(, const A%n& a%n%)) {%( - ref p%n(to_python(search_namespace, a%n));%) + ref p%n(to_python(a%n, lookup_tag()));%) ref result(PyEval_CallMethod(self, const_cast(name), const_cast("(%(O%))")%(, p%n.get()%))); @@ -49,7 +49,7 @@ struct callback %{ template <%(class A%n%:, %)> %} static R call(PyObject* self%(, const A%n& a%n%)) {%( - ref p%n(to_python(search_namespace, a%n));%) + ref p%n(to_python(a%n, lookup_tag()));%) ref result(PyEval_CallFunction(self, const_cast("(%(O%))")%(, p%n.get()%))); detail::callback_adjust_refcount(result.get(), type()); @@ -70,7 +70,7 @@ struct callback %{ template <%(class A%n%:, %)> %} static void call_method(PyObject* self, const char* name%(, const A%n& a%n%)) {%( - ref p%n(to_python(search_namespace, a%n));%) + ref p%n(to_python(a%n, lookup_tag()));%) ref result(PyEval_CallMethod(self, const_cast(name), const_cast("(%(O%))")%(, p%n.get()%))); @@ -79,7 +79,7 @@ struct callback %{ template <%(class A%n%:, %)> %} static void call(PyObject* self%(, const A%n& a%n%)) {%( - ref p%n(to_python(search_namespace, a%n));%) + ref p%n(to_python(a%n, lookup_tag()));%) ref result(PyEval_CallFunction(self, const_cast("(%(O%))")%(, p%n.get()%))); } diff --git a/src/gen_caller.py b/src/gen_caller.py index b6b59be5..946530c9 100644 --- a/src/gen_caller.py +++ b/src/gen_caller.py @@ -97,14 +97,14 @@ def gen_caller(member_function_args, free_function_args = None): return (header % (member_function_args, free_function_args) + body_sections[0] + gen_functions(member_function, member_function_args, - 'R', '', 'return to_python(search_namespace, ', ');') + 'R', '', 'return to_python(', ', lookup_tag());') + body_sections[1] + gen_functions(member_function, member_function_args, - 'R', ' const', 'return to_python(search_namespace, ', ');') + 'R', ' const', 'return to_python(', ', lookup_tag());') + body_sections[2] + gen_functions(free_function, free_function_args, - 'R', 'return to_python(search_namespace, ', ');') + 'R', 'return to_python(', ', lookup_tag());') + body_sections[3] # specialized part for void return values begins here diff --git a/src/gen_extclass.py b/src/gen_extclass.py index 7434cba4..01dea67f 100644 --- a/src/gen_extclass.py +++ b/src/gen_extclass.py @@ -187,7 +187,7 @@ class python_extension_class_converters /// Get an object which can be used to convert T to/from python. This is used /// as a kind of concept check by the free template function /// - /// PyObject* to_python(boost::python::semantics, const T& x) + /// PyObject* to_python(const T& x, boost::python::lookup_tag) /// /// below this class, to prevent the confusing messages that would otherwise /// pop up. Now, if T hasn't been wrapped as an extension class, the user @@ -205,7 +205,7 @@ class python_extension_class_converters /// a compiler error. Instead, we access this function through the global /// template /// - /// PyObject* to_python(boost::python::semantics, const T& x) + /// PyObject* to_python(const T& x, boost::python::lookup_tag) /// /// defined below this class. Since template functions are instantiated only /// on demand, errors will be avoided unless T is noncopyable and the user @@ -346,7 +346,7 @@ class python_extension_class_converters friend const std::auto_ptr& from_python(PyObject* p, boost::python::type&>) { return smart_ptr_value(p, boost::python::type >()); } - friend PyObject* to_python(boost::python::semantics, std::auto_ptr x) + friend PyObject* to_python(std::auto_ptr x, boost::python::lookup_tag) { return smart_ptr_to_python(x); } friend boost::shared_ptr& from_python(PyObject* p, boost::python::type&>) @@ -358,7 +358,7 @@ class python_extension_class_converters friend const boost::shared_ptr& from_python(PyObject* p, boost::python::type&>) { return smart_ptr_value(p, boost::python::type >()); } - friend PyObject* to_python(boost::python::semantics, boost::shared_ptr x) + friend PyObject* to_python(boost::shared_ptr x, boost::python::lookup_tag) { return smart_ptr_to_python(x); } }; @@ -367,7 +367,7 @@ class python_extension_class_converters // T is a wrapped class. See the first 2 functions declared in // python_extension_class_converters above for more info. template -PyObject* to_python(boost::python::semantics, const T& x) +PyObject* to_python(const T& x, boost::python::lookup_tag) { return py_extension_class_converters(boost::python::type()).m_to_python(x); } diff --git a/src/objects.cpp b/src/objects.cpp index 82fd739c..8264b253 100644 --- a/src/objects.cpp +++ b/src/objects.cpp @@ -49,7 +49,7 @@ PyObject* object::get() const BOOST_PYTHON_BEGIN_CONVERSION_NAMESPACE -PyObject* to_python(boost::python::semantics, const boost::python::tuple& x) +PyObject* to_python(const boost::python::tuple& x, boost::python::lookup_tag) { return boost::python::object_to_python(x); } @@ -59,7 +59,7 @@ boost::python::tuple from_python(PyObject* p, boost::python::type()); int fourth = from_python(keywords[boost::python::string("fourth")].get(), boost::python::type()); - return to_python(boost::python::search_namespace, first->i_ + second + third + fourth); + return to_python(first->i_ + second + third + fourth, boost::python::lookup_tag()); } void init_module()