diff --git a/include/boost/python/detail/returning.hpp b/include/boost/python/detail/returning.hpp index 599e5d37..d7e98cd8 100644 --- a/include/boost/python/detail/returning.hpp +++ b/include/boost/python/detail/returning.hpp @@ -1,5 +1,5 @@ -// (C) Copyright David Abrahams 2001. Permission to copy, use, modify, sell and -// distribute this software is granted provided this copyright notice appears +// (C) Copyright David Abrahams 2001,2002. Permission to copy, use, modify, sell +// and distribute this software is granted provided this copyright notice appears // in all copies. This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -23,10 +23,10 @@ template struct returning { template - static PyObject* call(R (A0::*pmf)(), PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(), PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; // find the result converter @@ -34,20 +34,20 @@ struct returning typename eval::type cr; if (!cr.convertible()) return 0; - if (!policies.precall(args)) return 0; + if (!policies.precall(args_)) return 0; + + PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + ) ); - PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)() ); - - if (!result) return 0; - return policies.postcall(args, result); + return policies.postcall(args_, result); } template - static PyObject* call(R (A0::*pmf)(A1), PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1), PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; // find the result converter @@ -55,22 +55,22 @@ struct returning typename eval::type cr; if (!cr.convertible()) return 0; - if (!policies.precall(args)) return 0; + if (!policies.precall(args_)) return 0; + + PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1))) ); - PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1))) ); - - if (!result) return 0; - return policies.postcall(args, result); + return policies.postcall(args_, result); } template - static PyObject* call(R (A0::*pmf)(A1, A2), PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1, A2), PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; // find the result converter @@ -78,24 +78,25 @@ struct returning typename eval::type cr; if (!cr.convertible()) return 0; - if (!policies.precall(args)) return 0; + if (!policies.precall(args_)) return 0; + + PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2))) ); - PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2))) ); - - if (!result) return 0; - return policies.postcall(args, result); + return policies.postcall(args_, result); } template - static PyObject* call(R (A0::*pmf)(A1, A2, A3), PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1, A2, A3), PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; - from_python c3(PyTuple_GET_ITEM(args, 3)); + from_python c3(PyTuple_GET_ITEM(args_, 3)); if (!c3.convertible()) return 0; // find the result converter @@ -103,26 +104,28 @@ struct returning typename eval::type cr; if (!cr.convertible()) return 0; - if (!policies.precall(args)) return 0; + if (!policies.precall(args_)) return 0; + + PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2)) + , c3(PyTuple_GET_ITEM(args_, 3))) ); - PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2)), c3(PyTuple_GET_ITEM(args, 3))) ); - - if (!result) return 0; - return policies.postcall(args, result); + return policies.postcall(args_, result); } template - static PyObject* call(R (A0::*pmf)(A1, A2, A3, A4), PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1, A2, A3, A4), PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; - from_python c3(PyTuple_GET_ITEM(args, 3)); + from_python c3(PyTuple_GET_ITEM(args_, 3)); if (!c3.convertible()) return 0; - from_python c4(PyTuple_GET_ITEM(args, 4)); + from_python c4(PyTuple_GET_ITEM(args_, 4)); if (!c4.convertible()) return 0; // find the result converter @@ -130,28 +133,31 @@ struct returning typename eval::type cr; if (!cr.convertible()) return 0; - if (!policies.precall(args)) return 0; + if (!policies.precall(args_)) return 0; + + PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2)) + , c3(PyTuple_GET_ITEM(args_, 3)) + , c4(PyTuple_GET_ITEM(args_, 4))) ); - PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2)), c3(PyTuple_GET_ITEM(args, 3)), c4(PyTuple_GET_ITEM(args, 4))) ); - - if (!result) return 0; - return policies.postcall(args, result); + return policies.postcall(args_, result); } template - static PyObject* call(R (A0::*pmf)(A1, A2, A3, A4, A5), PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1, A2, A3, A4, A5), PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; - from_python c3(PyTuple_GET_ITEM(args, 3)); + from_python c3(PyTuple_GET_ITEM(args_, 3)); if (!c3.convertible()) return 0; - from_python c4(PyTuple_GET_ITEM(args, 4)); + from_python c4(PyTuple_GET_ITEM(args_, 4)); if (!c4.convertible()) return 0; - from_python c5(PyTuple_GET_ITEM(args, 5)); + from_python c5(PyTuple_GET_ITEM(args_, 5)); if (!c5.convertible()) return 0; // find the result converter @@ -159,19 +165,23 @@ struct returning typename eval::type cr; if (!cr.convertible()) return 0; - if (!policies.precall(args)) return 0; + if (!policies.precall(args_)) return 0; + + PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2)) + , c3(PyTuple_GET_ITEM(args_, 3)) + , c4(PyTuple_GET_ITEM(args_, 4)) + , c5(PyTuple_GET_ITEM(args_, 5))) ); - PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2)), c3(PyTuple_GET_ITEM(args, 3)), c4(PyTuple_GET_ITEM(args, 4)), c5(PyTuple_GET_ITEM(args, 5))) ); - - if (!result) return 0; - return policies.postcall(args, result); + return policies.postcall(args_, result); } template - static PyObject* call(R (A0::*pmf)() const, PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)() const, PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; // find the result converter @@ -179,20 +189,20 @@ struct returning typename eval::type cr; if (!cr.convertible()) return 0; - if (!policies.precall(args)) return 0; + if (!policies.precall(args_)) return 0; + + PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + ) ); - PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)() ); - - if (!result) return 0; - return policies.postcall(args, result); + return policies.postcall(args_, result); } template - static PyObject* call(R (A0::*pmf)(A1) const, PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1) const, PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; // find the result converter @@ -200,22 +210,22 @@ struct returning typename eval::type cr; if (!cr.convertible()) return 0; - if (!policies.precall(args)) return 0; + if (!policies.precall(args_)) return 0; + + PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1))) ); - PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1))) ); - - if (!result) return 0; - return policies.postcall(args, result); + return policies.postcall(args_, result); } template - static PyObject* call(R (A0::*pmf)(A1, A2) const, PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1, A2) const, PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; // find the result converter @@ -223,24 +233,25 @@ struct returning typename eval::type cr; if (!cr.convertible()) return 0; - if (!policies.precall(args)) return 0; + if (!policies.precall(args_)) return 0; + + PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2))) ); - PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2))) ); - - if (!result) return 0; - return policies.postcall(args, result); + return policies.postcall(args_, result); } template - static PyObject* call(R (A0::*pmf)(A1, A2, A3) const, PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1, A2, A3) const, PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; - from_python c3(PyTuple_GET_ITEM(args, 3)); + from_python c3(PyTuple_GET_ITEM(args_, 3)); if (!c3.convertible()) return 0; // find the result converter @@ -248,26 +259,28 @@ struct returning typename eval::type cr; if (!cr.convertible()) return 0; - if (!policies.precall(args)) return 0; + if (!policies.precall(args_)) return 0; + + PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2)) + , c3(PyTuple_GET_ITEM(args_, 3))) ); - PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2)), c3(PyTuple_GET_ITEM(args, 3))) ); - - if (!result) return 0; - return policies.postcall(args, result); + return policies.postcall(args_, result); } template - static PyObject* call(R (A0::*pmf)(A1, A2, A3, A4) const, PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1, A2, A3, A4) const, PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; - from_python c3(PyTuple_GET_ITEM(args, 3)); + from_python c3(PyTuple_GET_ITEM(args_, 3)); if (!c3.convertible()) return 0; - from_python c4(PyTuple_GET_ITEM(args, 4)); + from_python c4(PyTuple_GET_ITEM(args_, 4)); if (!c4.convertible()) return 0; // find the result converter @@ -275,28 +288,31 @@ struct returning typename eval::type cr; if (!cr.convertible()) return 0; - if (!policies.precall(args)) return 0; + if (!policies.precall(args_)) return 0; + + PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2)) + , c3(PyTuple_GET_ITEM(args_, 3)) + , c4(PyTuple_GET_ITEM(args_, 4))) ); - PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2)), c3(PyTuple_GET_ITEM(args, 3)), c4(PyTuple_GET_ITEM(args, 4))) ); - - if (!result) return 0; - return policies.postcall(args, result); + return policies.postcall(args_, result); } template - static PyObject* call(R (A0::*pmf)(A1, A2, A3, A4, A5) const, PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1, A2, A3, A4, A5) const, PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; - from_python c3(PyTuple_GET_ITEM(args, 3)); + from_python c3(PyTuple_GET_ITEM(args_, 3)); if (!c3.convertible()) return 0; - from_python c4(PyTuple_GET_ITEM(args, 4)); + from_python c4(PyTuple_GET_ITEM(args_, 4)); if (!c4.convertible()) return 0; - from_python c5(PyTuple_GET_ITEM(args, 5)); + from_python c5(PyTuple_GET_ITEM(args_, 5)); if (!c5.convertible()) return 0; // find the result converter @@ -304,19 +320,23 @@ struct returning typename eval::type cr; if (!cr.convertible()) return 0; - if (!policies.precall(args)) return 0; + if (!policies.precall(args_)) return 0; + + PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2)) + , c3(PyTuple_GET_ITEM(args_, 3)) + , c4(PyTuple_GET_ITEM(args_, 4)) + , c5(PyTuple_GET_ITEM(args_, 5))) ); - PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2)), c3(PyTuple_GET_ITEM(args, 3)), c4(PyTuple_GET_ITEM(args, 4)), c5(PyTuple_GET_ITEM(args, 5))) ); - - if (!result) return 0; - return policies.postcall(args, result); + return policies.postcall(args_, result); } template - static PyObject* call(R (A0::*pmf)() volatile, PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)() volatile, PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; // find the result converter @@ -324,20 +344,20 @@ struct returning typename eval::type cr; if (!cr.convertible()) return 0; - if (!policies.precall(args)) return 0; + if (!policies.precall(args_)) return 0; + + PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + ) ); - PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)() ); - - if (!result) return 0; - return policies.postcall(args, result); + return policies.postcall(args_, result); } template - static PyObject* call(R (A0::*pmf)(A1) volatile, PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1) volatile, PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; // find the result converter @@ -345,22 +365,22 @@ struct returning typename eval::type cr; if (!cr.convertible()) return 0; - if (!policies.precall(args)) return 0; + if (!policies.precall(args_)) return 0; + + PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1))) ); - PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1))) ); - - if (!result) return 0; - return policies.postcall(args, result); + return policies.postcall(args_, result); } template - static PyObject* call(R (A0::*pmf)(A1, A2) volatile, PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1, A2) volatile, PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; // find the result converter @@ -368,24 +388,25 @@ struct returning typename eval::type cr; if (!cr.convertible()) return 0; - if (!policies.precall(args)) return 0; + if (!policies.precall(args_)) return 0; + + PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2))) ); - PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2))) ); - - if (!result) return 0; - return policies.postcall(args, result); + return policies.postcall(args_, result); } template - static PyObject* call(R (A0::*pmf)(A1, A2, A3) volatile, PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1, A2, A3) volatile, PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; - from_python c3(PyTuple_GET_ITEM(args, 3)); + from_python c3(PyTuple_GET_ITEM(args_, 3)); if (!c3.convertible()) return 0; // find the result converter @@ -393,26 +414,28 @@ struct returning typename eval::type cr; if (!cr.convertible()) return 0; - if (!policies.precall(args)) return 0; + if (!policies.precall(args_)) return 0; + + PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2)) + , c3(PyTuple_GET_ITEM(args_, 3))) ); - PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2)), c3(PyTuple_GET_ITEM(args, 3))) ); - - if (!result) return 0; - return policies.postcall(args, result); + return policies.postcall(args_, result); } template - static PyObject* call(R (A0::*pmf)(A1, A2, A3, A4) volatile, PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1, A2, A3, A4) volatile, PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; - from_python c3(PyTuple_GET_ITEM(args, 3)); + from_python c3(PyTuple_GET_ITEM(args_, 3)); if (!c3.convertible()) return 0; - from_python c4(PyTuple_GET_ITEM(args, 4)); + from_python c4(PyTuple_GET_ITEM(args_, 4)); if (!c4.convertible()) return 0; // find the result converter @@ -420,28 +443,31 @@ struct returning typename eval::type cr; if (!cr.convertible()) return 0; - if (!policies.precall(args)) return 0; + if (!policies.precall(args_)) return 0; + + PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2)) + , c3(PyTuple_GET_ITEM(args_, 3)) + , c4(PyTuple_GET_ITEM(args_, 4))) ); - PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2)), c3(PyTuple_GET_ITEM(args, 3)), c4(PyTuple_GET_ITEM(args, 4))) ); - - if (!result) return 0; - return policies.postcall(args, result); + return policies.postcall(args_, result); } template - static PyObject* call(R (A0::*pmf)(A1, A2, A3, A4, A5) volatile, PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1, A2, A3, A4, A5) volatile, PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; - from_python c3(PyTuple_GET_ITEM(args, 3)); + from_python c3(PyTuple_GET_ITEM(args_, 3)); if (!c3.convertible()) return 0; - from_python c4(PyTuple_GET_ITEM(args, 4)); + from_python c4(PyTuple_GET_ITEM(args_, 4)); if (!c4.convertible()) return 0; - from_python c5(PyTuple_GET_ITEM(args, 5)); + from_python c5(PyTuple_GET_ITEM(args_, 5)); if (!c5.convertible()) return 0; // find the result converter @@ -449,22 +475,26 @@ struct returning typename eval::type cr; if (!cr.convertible()) return 0; - if (!policies.precall(args)) return 0; + if (!policies.precall(args_)) return 0; + + PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2)) + , c3(PyTuple_GET_ITEM(args_, 3)) + , c4(PyTuple_GET_ITEM(args_, 4)) + , c5(PyTuple_GET_ITEM(args_, 5))) ); - PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2)), c3(PyTuple_GET_ITEM(args, 3)), c4(PyTuple_GET_ITEM(args, 4)), c5(PyTuple_GET_ITEM(args, 5))) ); - - if (!result) return 0; - return policies.postcall(args, result); + return policies.postcall(args_, result); } // missing const volatile type traits # ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION template - static PyObject* call(R (A0::*pmf)() const volatile, PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)() const volatile, PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; // find the result converter @@ -472,20 +502,20 @@ struct returning typename eval::type cr; if (!cr.convertible()) return 0; - if (!policies.precall(args)) return 0; + if (!policies.precall(args_)) return 0; + + PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + ) ); - PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)() ); - - if (!result) return 0; - return policies.postcall(args, result); + return policies.postcall(args_, result); } template - static PyObject* call(R (A0::*pmf)(A1) const volatile, PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1) const volatile, PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; // find the result converter @@ -493,22 +523,22 @@ struct returning typename eval::type cr; if (!cr.convertible()) return 0; - if (!policies.precall(args)) return 0; + if (!policies.precall(args_)) return 0; + + PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1))) ); - PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1))) ); - - if (!result) return 0; - return policies.postcall(args, result); + return policies.postcall(args_, result); } template - static PyObject* call(R (A0::*pmf)(A1, A2) const volatile, PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1, A2) const volatile, PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; // find the result converter @@ -516,24 +546,25 @@ struct returning typename eval::type cr; if (!cr.convertible()) return 0; - if (!policies.precall(args)) return 0; + if (!policies.precall(args_)) return 0; + + PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2))) ); - PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2))) ); - - if (!result) return 0; - return policies.postcall(args, result); + return policies.postcall(args_, result); } template - static PyObject* call(R (A0::*pmf)(A1, A2, A3) const volatile, PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1, A2, A3) const volatile, PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; - from_python c3(PyTuple_GET_ITEM(args, 3)); + from_python c3(PyTuple_GET_ITEM(args_, 3)); if (!c3.convertible()) return 0; // find the result converter @@ -541,26 +572,28 @@ struct returning typename eval::type cr; if (!cr.convertible()) return 0; - if (!policies.precall(args)) return 0; + if (!policies.precall(args_)) return 0; + + PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2)) + , c3(PyTuple_GET_ITEM(args_, 3))) ); - PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2)), c3(PyTuple_GET_ITEM(args, 3))) ); - - if (!result) return 0; - return policies.postcall(args, result); + return policies.postcall(args_, result); } template - static PyObject* call(R (A0::*pmf)(A1, A2, A3, A4) const volatile, PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1, A2, A3, A4) const volatile, PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; - from_python c3(PyTuple_GET_ITEM(args, 3)); + from_python c3(PyTuple_GET_ITEM(args_, 3)); if (!c3.convertible()) return 0; - from_python c4(PyTuple_GET_ITEM(args, 4)); + from_python c4(PyTuple_GET_ITEM(args_, 4)); if (!c4.convertible()) return 0; // find the result converter @@ -568,28 +601,31 @@ struct returning typename eval::type cr; if (!cr.convertible()) return 0; - if (!policies.precall(args)) return 0; + if (!policies.precall(args_)) return 0; + + PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2)) + , c3(PyTuple_GET_ITEM(args_, 3)) + , c4(PyTuple_GET_ITEM(args_, 4))) ); - PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2)), c3(PyTuple_GET_ITEM(args, 3)), c4(PyTuple_GET_ITEM(args, 4))) ); - - if (!result) return 0; - return policies.postcall(args, result); + return policies.postcall(args_, result); } template - static PyObject* call(R (A0::*pmf)(A1, A2, A3, A4, A5) const volatile, PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1, A2, A3, A4, A5) const volatile, PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; - from_python c3(PyTuple_GET_ITEM(args, 3)); + from_python c3(PyTuple_GET_ITEM(args_, 3)); if (!c3.convertible()) return 0; - from_python c4(PyTuple_GET_ITEM(args, 4)); + from_python c4(PyTuple_GET_ITEM(args_, 4)); if (!c4.convertible()) return 0; - from_python c5(PyTuple_GET_ITEM(args, 5)); + from_python c5(PyTuple_GET_ITEM(args_, 5)); if (!c5.convertible()) return 0; // find the result converter @@ -597,176 +633,193 @@ struct returning typename eval::type cr; if (!cr.convertible()) return 0; - if (!policies.precall(args)) return 0; + if (!policies.precall(args_)) return 0; + + PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2)) + , c3(PyTuple_GET_ITEM(args_, 3)) + , c4(PyTuple_GET_ITEM(args_, 4)) + , c5(PyTuple_GET_ITEM(args_, 5))) ); - PyObject* result = cr( ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2)), c3(PyTuple_GET_ITEM(args, 3)), c4(PyTuple_GET_ITEM(args, 4)), c5(PyTuple_GET_ITEM(args, 5))) ); - - if (!result) return 0; - return policies.postcall(args, result); + return policies.postcall(args_, result); } # endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - - + template - static PyObject* call(R (*pf)(), PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (*pf)(), PyObject* args_, PyObject*, P const& policies) { // find the result converter typedef typename P::result_converter result_converter; - typename eval::type c0; - if (!c0.convertible()) return 0; + typename eval::type cr; + if (!cr.convertible()) return 0; - if (!policies.precall(args)) return 0; + if (!policies.precall(args_)) return 0; - PyObject* result = c0( (*pf)() ); - - if (!result) return 0; - return policies.postcall(args, result); + PyObject* result = cr( (*pf)( + ) ); + + return policies.postcall(args_, result); } - template - static PyObject* call(R (*pf)(A0), PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (*pf)(A0), PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; // find the result converter typedef typename P::result_converter result_converter; - typename eval::type c1; - if (!c1.convertible()) return 0; + typename eval::type cr; + if (!cr.convertible()) return 0; - if (!policies.precall(args)) return 0; + if (!policies.precall(args_)) return 0; - PyObject* result = c1( (*pf)(c0(PyTuple_GET_ITEM(args, 0))) ); - - if (!result) return 0; - return policies.postcall(args, result); + PyObject* result = cr( (*pf)( + c0(PyTuple_GET_ITEM(args_, 0))) ); + + return policies.postcall(args_, result); } template - static PyObject* call(R (*pf)(A0, A1), PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (*pf)(A0, A1), PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; // find the result converter typedef typename P::result_converter result_converter; - typename eval::type c2; - if (!c2.convertible()) return 0; + typename eval::type cr; + if (!cr.convertible()) return 0; - if (!policies.precall(args)) return 0; + if (!policies.precall(args_)) return 0; - PyObject* result = c2( (*pf)(c0(PyTuple_GET_ITEM(args, 0)), c1(PyTuple_GET_ITEM(args, 1))) ); - - if (!result) return 0; - return policies.postcall(args, result); + PyObject* result = cr( (*pf)( + c0(PyTuple_GET_ITEM(args_, 0)) + , c1(PyTuple_GET_ITEM(args_, 1))) ); + + return policies.postcall(args_, result); } template - static PyObject* call(R (*pf)(A0, A1, A2), PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (*pf)(A0, A1, A2), PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; // find the result converter typedef typename P::result_converter result_converter; - typename eval::type c3; - if (!c3.convertible()) return 0; + typename eval::type cr; + if (!cr.convertible()) return 0; - if (!policies.precall(args)) return 0; + if (!policies.precall(args_)) return 0; - PyObject* result = c3( (*pf)(c0(PyTuple_GET_ITEM(args, 0)), c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2))) ); - - if (!result) return 0; - return policies.postcall(args, result); + PyObject* result = cr( (*pf)( + c0(PyTuple_GET_ITEM(args_, 0)) + , c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2))) ); + + return policies.postcall(args_, result); } template - static PyObject* call(R (*pf)(A0, A1, A2, A3), PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (*pf)(A0, A1, A2, A3), PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; - from_python c3(PyTuple_GET_ITEM(args, 3)); + from_python c3(PyTuple_GET_ITEM(args_, 3)); if (!c3.convertible()) return 0; // find the result converter typedef typename P::result_converter result_converter; - typename eval::type c4; - if (!c4.convertible()) return 0; + typename eval::type cr; + if (!cr.convertible()) return 0; - if (!policies.precall(args)) return 0; + if (!policies.precall(args_)) return 0; - PyObject* result = c4( (*pf)(c0(PyTuple_GET_ITEM(args, 0)), c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2)), c3(PyTuple_GET_ITEM(args, 3))) ); - - if (!result) return 0; - return policies.postcall(args, result); + PyObject* result = cr( (*pf)( + c0(PyTuple_GET_ITEM(args_, 0)) + , c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2)) + , c3(PyTuple_GET_ITEM(args_, 3))) ); + + return policies.postcall(args_, result); } template - static PyObject* call(R (*pf)(A0, A1, A2, A3, A4), PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (*pf)(A0, A1, A2, A3, A4), PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; - from_python c3(PyTuple_GET_ITEM(args, 3)); + from_python c3(PyTuple_GET_ITEM(args_, 3)); if (!c3.convertible()) return 0; - from_python c4(PyTuple_GET_ITEM(args, 4)); + from_python c4(PyTuple_GET_ITEM(args_, 4)); if (!c4.convertible()) return 0; // find the result converter typedef typename P::result_converter result_converter; - typename eval::type c5; - if (!c5.convertible()) return 0; + typename eval::type cr; + if (!cr.convertible()) return 0; - if (!policies.precall(args)) return 0; + if (!policies.precall(args_)) return 0; - PyObject* result = c5( (*pf)(c0(PyTuple_GET_ITEM(args, 0)), c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2)), c3(PyTuple_GET_ITEM(args, 3)), c4(PyTuple_GET_ITEM(args, 4))) ); - - if (!result) return 0; - return policies.postcall(args, result); + PyObject* result = cr( (*pf)( + c0(PyTuple_GET_ITEM(args_, 0)) + , c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2)) + , c3(PyTuple_GET_ITEM(args_, 3)) + , c4(PyTuple_GET_ITEM(args_, 4))) ); + + return policies.postcall(args_, result); } template - static PyObject* call(R (*pf)(A0, A1, A2, A3, A4, A5), PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (*pf)(A0, A1, A2, A3, A4, A5), PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; - from_python c3(PyTuple_GET_ITEM(args, 3)); + from_python c3(PyTuple_GET_ITEM(args_, 3)); if (!c3.convertible()) return 0; - from_python c4(PyTuple_GET_ITEM(args, 4)); + from_python c4(PyTuple_GET_ITEM(args_, 4)); if (!c4.convertible()) return 0; - from_python c5(PyTuple_GET_ITEM(args, 5)); + from_python c5(PyTuple_GET_ITEM(args_, 5)); if (!c5.convertible()) return 0; // find the result converter typedef typename P::result_converter result_converter; - typename eval::type c6; - if (!c6.convertible()) return 0; + typename eval::type cr; + if (!cr.convertible()) return 0; - if (!policies.precall(args)) return 0; + if (!policies.precall(args_)) return 0; - PyObject* result = c6( (*pf)(c0(PyTuple_GET_ITEM(args, 0)), c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2)), c3(PyTuple_GET_ITEM(args, 3)), c4(PyTuple_GET_ITEM(args, 4)), c5(PyTuple_GET_ITEM(args, 5))) ); - - if (!result) return 0; - return policies.postcall(args, result); + PyObject* result = cr( (*pf)( + c0(PyTuple_GET_ITEM(args_, 0)) + , c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2)) + , c3(PyTuple_GET_ITEM(args_, 3)) + , c4(PyTuple_GET_ITEM(args_, 4)) + , c5(PyTuple_GET_ITEM(args_, 5))) ); + + return policies.postcall(args_, result); } }; @@ -775,560 +828,646 @@ struct returning { typedef void R; template - static PyObject* call(R (A0::*pmf)(), PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(), PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; + + if (!policies.precall(args_)) return 0; + + ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + ); - if (!policies.precall(args)) return 0; - - ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(); - - return policies.postcall(args, detail::none()); + return policies.postcall(args_, detail::none()); } template - static PyObject* call(R (A0::*pmf)(A1), PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1), PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; + + if (!policies.precall(args_)) return 0; + + ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1))); - if (!policies.precall(args)) return 0; - - ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1))); - - return policies.postcall(args, detail::none()); + return policies.postcall(args_, detail::none()); } template - static PyObject* call(R (A0::*pmf)(A1, A2), PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1, A2), PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; + + if (!policies.precall(args_)) return 0; + + ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2))); - if (!policies.precall(args)) return 0; - - ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2))); - - return policies.postcall(args, detail::none()); + return policies.postcall(args_, detail::none()); } template - static PyObject* call(R (A0::*pmf)(A1, A2, A3), PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1, A2, A3), PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; - from_python c3(PyTuple_GET_ITEM(args, 3)); + from_python c3(PyTuple_GET_ITEM(args_, 3)); if (!c3.convertible()) return 0; + + if (!policies.precall(args_)) return 0; + + ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2)) + , c3(PyTuple_GET_ITEM(args_, 3))); - if (!policies.precall(args)) return 0; - - ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2)), c3(PyTuple_GET_ITEM(args, 3))); - - return policies.postcall(args, detail::none()); + return policies.postcall(args_, detail::none()); } template - static PyObject* call(R (A0::*pmf)(A1, A2, A3, A4), PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1, A2, A3, A4), PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; - from_python c3(PyTuple_GET_ITEM(args, 3)); + from_python c3(PyTuple_GET_ITEM(args_, 3)); if (!c3.convertible()) return 0; - from_python c4(PyTuple_GET_ITEM(args, 4)); + from_python c4(PyTuple_GET_ITEM(args_, 4)); if (!c4.convertible()) return 0; + + if (!policies.precall(args_)) return 0; + + ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2)) + , c3(PyTuple_GET_ITEM(args_, 3)) + , c4(PyTuple_GET_ITEM(args_, 4))); - if (!policies.precall(args)) return 0; - - ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2)), c3(PyTuple_GET_ITEM(args, 3)), c4(PyTuple_GET_ITEM(args, 4))); - - return policies.postcall(args, detail::none()); + return policies.postcall(args_, detail::none()); } template - static PyObject* call(R (A0::*pmf)(A1, A2, A3, A4, A5), PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1, A2, A3, A4, A5), PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; - from_python c3(PyTuple_GET_ITEM(args, 3)); + from_python c3(PyTuple_GET_ITEM(args_, 3)); if (!c3.convertible()) return 0; - from_python c4(PyTuple_GET_ITEM(args, 4)); + from_python c4(PyTuple_GET_ITEM(args_, 4)); if (!c4.convertible()) return 0; - from_python c5(PyTuple_GET_ITEM(args, 5)); + from_python c5(PyTuple_GET_ITEM(args_, 5)); if (!c5.convertible()) return 0; + + if (!policies.precall(args_)) return 0; + + ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2)) + , c3(PyTuple_GET_ITEM(args_, 3)) + , c4(PyTuple_GET_ITEM(args_, 4)) + , c5(PyTuple_GET_ITEM(args_, 5))); - if (!policies.precall(args)) return 0; - - ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2)), c3(PyTuple_GET_ITEM(args, 3)), c4(PyTuple_GET_ITEM(args, 4)), c5(PyTuple_GET_ITEM(args, 5))); - - return policies.postcall(args, detail::none()); + return policies.postcall(args_, detail::none()); } template - static PyObject* call(R (A0::*pmf)() const, PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)() const, PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; + + if (!policies.precall(args_)) return 0; + + ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + ); - if (!policies.precall(args)) return 0; - - ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(); - - return policies.postcall(args, detail::none()); + return policies.postcall(args_, detail::none()); } template - static PyObject* call(R (A0::*pmf)(A1) const, PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1) const, PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; + + if (!policies.precall(args_)) return 0; + + ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1))); - if (!policies.precall(args)) return 0; - - ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1))); - - return policies.postcall(args, detail::none()); + return policies.postcall(args_, detail::none()); } template - static PyObject* call(R (A0::*pmf)(A1, A2) const, PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1, A2) const, PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; + + if (!policies.precall(args_)) return 0; + + ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2))); - if (!policies.precall(args)) return 0; - - ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2))); - - return policies.postcall(args, detail::none()); + return policies.postcall(args_, detail::none()); } template - static PyObject* call(R (A0::*pmf)(A1, A2, A3) const, PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1, A2, A3) const, PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; - from_python c3(PyTuple_GET_ITEM(args, 3)); + from_python c3(PyTuple_GET_ITEM(args_, 3)); if (!c3.convertible()) return 0; + + if (!policies.precall(args_)) return 0; + + ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2)) + , c3(PyTuple_GET_ITEM(args_, 3))); - if (!policies.precall(args)) return 0; - - ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2)), c3(PyTuple_GET_ITEM(args, 3))); - - return policies.postcall(args, detail::none()); + return policies.postcall(args_, detail::none()); } template - static PyObject* call(R (A0::*pmf)(A1, A2, A3, A4) const, PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1, A2, A3, A4) const, PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; - from_python c3(PyTuple_GET_ITEM(args, 3)); + from_python c3(PyTuple_GET_ITEM(args_, 3)); if (!c3.convertible()) return 0; - from_python c4(PyTuple_GET_ITEM(args, 4)); + from_python c4(PyTuple_GET_ITEM(args_, 4)); if (!c4.convertible()) return 0; + + if (!policies.precall(args_)) return 0; + + ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2)) + , c3(PyTuple_GET_ITEM(args_, 3)) + , c4(PyTuple_GET_ITEM(args_, 4))); - if (!policies.precall(args)) return 0; - - ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2)), c3(PyTuple_GET_ITEM(args, 3)), c4(PyTuple_GET_ITEM(args, 4))); - - return policies.postcall(args, detail::none()); + return policies.postcall(args_, detail::none()); } template - static PyObject* call(R (A0::*pmf)(A1, A2, A3, A4, A5) const, PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1, A2, A3, A4, A5) const, PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; - from_python c3(PyTuple_GET_ITEM(args, 3)); + from_python c3(PyTuple_GET_ITEM(args_, 3)); if (!c3.convertible()) return 0; - from_python c4(PyTuple_GET_ITEM(args, 4)); + from_python c4(PyTuple_GET_ITEM(args_, 4)); if (!c4.convertible()) return 0; - from_python c5(PyTuple_GET_ITEM(args, 5)); + from_python c5(PyTuple_GET_ITEM(args_, 5)); if (!c5.convertible()) return 0; + + if (!policies.precall(args_)) return 0; + + ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2)) + , c3(PyTuple_GET_ITEM(args_, 3)) + , c4(PyTuple_GET_ITEM(args_, 4)) + , c5(PyTuple_GET_ITEM(args_, 5))); - if (!policies.precall(args)) return 0; - - ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2)), c3(PyTuple_GET_ITEM(args, 3)), c4(PyTuple_GET_ITEM(args, 4)), c5(PyTuple_GET_ITEM(args, 5))); - - return policies.postcall(args, detail::none()); + return policies.postcall(args_, detail::none()); } template - static PyObject* call(R (A0::*pmf)() volatile, PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)() volatile, PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; + + if (!policies.precall(args_)) return 0; + + ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + ); - if (!policies.precall(args)) return 0; - - ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(); - - return policies.postcall(args, detail::none()); + return policies.postcall(args_, detail::none()); } template - static PyObject* call(R (A0::*pmf)(A1) volatile, PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1) volatile, PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; + + if (!policies.precall(args_)) return 0; + + ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1))); - if (!policies.precall(args)) return 0; - - ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1))); - - return policies.postcall(args, detail::none()); + return policies.postcall(args_, detail::none()); } template - static PyObject* call(R (A0::*pmf)(A1, A2) volatile, PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1, A2) volatile, PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; + + if (!policies.precall(args_)) return 0; + + ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2))); - if (!policies.precall(args)) return 0; - - ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2))); - - return policies.postcall(args, detail::none()); + return policies.postcall(args_, detail::none()); } template - static PyObject* call(R (A0::*pmf)(A1, A2, A3) volatile, PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1, A2, A3) volatile, PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; - from_python c3(PyTuple_GET_ITEM(args, 3)); + from_python c3(PyTuple_GET_ITEM(args_, 3)); if (!c3.convertible()) return 0; + + if (!policies.precall(args_)) return 0; + + ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2)) + , c3(PyTuple_GET_ITEM(args_, 3))); - if (!policies.precall(args)) return 0; - - ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2)), c3(PyTuple_GET_ITEM(args, 3))); - - return policies.postcall(args, detail::none()); + return policies.postcall(args_, detail::none()); } template - static PyObject* call(R (A0::*pmf)(A1, A2, A3, A4) volatile, PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1, A2, A3, A4) volatile, PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; - from_python c3(PyTuple_GET_ITEM(args, 3)); + from_python c3(PyTuple_GET_ITEM(args_, 3)); if (!c3.convertible()) return 0; - from_python c4(PyTuple_GET_ITEM(args, 4)); + from_python c4(PyTuple_GET_ITEM(args_, 4)); if (!c4.convertible()) return 0; + + if (!policies.precall(args_)) return 0; + + ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2)) + , c3(PyTuple_GET_ITEM(args_, 3)) + , c4(PyTuple_GET_ITEM(args_, 4))); - if (!policies.precall(args)) return 0; - - ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2)), c3(PyTuple_GET_ITEM(args, 3)), c4(PyTuple_GET_ITEM(args, 4))); - - return policies.postcall(args, detail::none()); + return policies.postcall(args_, detail::none()); } template - static PyObject* call(R (A0::*pmf)(A1, A2, A3, A4, A5) volatile, PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1, A2, A3, A4, A5) volatile, PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; - from_python c3(PyTuple_GET_ITEM(args, 3)); + from_python c3(PyTuple_GET_ITEM(args_, 3)); if (!c3.convertible()) return 0; - from_python c4(PyTuple_GET_ITEM(args, 4)); + from_python c4(PyTuple_GET_ITEM(args_, 4)); if (!c4.convertible()) return 0; - from_python c5(PyTuple_GET_ITEM(args, 5)); + from_python c5(PyTuple_GET_ITEM(args_, 5)); if (!c5.convertible()) return 0; + + if (!policies.precall(args_)) return 0; + + ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2)) + , c3(PyTuple_GET_ITEM(args_, 3)) + , c4(PyTuple_GET_ITEM(args_, 4)) + , c5(PyTuple_GET_ITEM(args_, 5))); - if (!policies.precall(args)) return 0; - - ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2)), c3(PyTuple_GET_ITEM(args, 3)), c4(PyTuple_GET_ITEM(args, 4)), c5(PyTuple_GET_ITEM(args, 5))); - - return policies.postcall(args, detail::none()); + return policies.postcall(args_, detail::none()); } // missing const volatile type traits # ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION template - static PyObject* call(R (A0::*pmf)() const volatile, PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)() const volatile, PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; + + if (!policies.precall(args_)) return 0; + + ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + ); - if (!policies.precall(args)) return 0; - - ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(); - - return policies.postcall(args, detail::none()); + return policies.postcall(args_, detail::none()); } template - static PyObject* call(R (A0::*pmf)(A1) const volatile, PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1) const volatile, PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; + + if (!policies.precall(args_)) return 0; + + ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1))); - if (!policies.precall(args)) return 0; - - ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1))); - - return policies.postcall(args, detail::none()); + return policies.postcall(args_, detail::none()); } template - static PyObject* call(R (A0::*pmf)(A1, A2) const volatile, PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1, A2) const volatile, PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; + + if (!policies.precall(args_)) return 0; + + ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2))); - if (!policies.precall(args)) return 0; - - ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2))); - - return policies.postcall(args, detail::none()); + return policies.postcall(args_, detail::none()); } template - static PyObject* call(R (A0::*pmf)(A1, A2, A3) const volatile, PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1, A2, A3) const volatile, PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; - from_python c3(PyTuple_GET_ITEM(args, 3)); + from_python c3(PyTuple_GET_ITEM(args_, 3)); if (!c3.convertible()) return 0; + + if (!policies.precall(args_)) return 0; + + ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2)) + , c3(PyTuple_GET_ITEM(args_, 3))); - if (!policies.precall(args)) return 0; - - ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2)), c3(PyTuple_GET_ITEM(args, 3))); - - return policies.postcall(args, detail::none()); + return policies.postcall(args_, detail::none()); } template - static PyObject* call(R (A0::*pmf)(A1, A2, A3, A4) const volatile, PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1, A2, A3, A4) const volatile, PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; - from_python c3(PyTuple_GET_ITEM(args, 3)); + from_python c3(PyTuple_GET_ITEM(args_, 3)); if (!c3.convertible()) return 0; - from_python c4(PyTuple_GET_ITEM(args, 4)); + from_python c4(PyTuple_GET_ITEM(args_, 4)); if (!c4.convertible()) return 0; + + if (!policies.precall(args_)) return 0; + + ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2)) + , c3(PyTuple_GET_ITEM(args_, 3)) + , c4(PyTuple_GET_ITEM(args_, 4))); - if (!policies.precall(args)) return 0; - - ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2)), c3(PyTuple_GET_ITEM(args, 3)), c4(PyTuple_GET_ITEM(args, 4))); - - return policies.postcall(args, detail::none()); + return policies.postcall(args_, detail::none()); } template - static PyObject* call(R (A0::*pmf)(A1, A2, A3, A4, A5) const volatile, PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (A0::*pmf)(A1, A2, A3, A4, A5) const volatile, PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; - from_python c3(PyTuple_GET_ITEM(args, 3)); + from_python c3(PyTuple_GET_ITEM(args_, 3)); if (!c3.convertible()) return 0; - from_python c4(PyTuple_GET_ITEM(args, 4)); + from_python c4(PyTuple_GET_ITEM(args_, 4)); if (!c4.convertible()) return 0; - from_python c5(PyTuple_GET_ITEM(args, 5)); + from_python c5(PyTuple_GET_ITEM(args_, 5)); if (!c5.convertible()) return 0; + + if (!policies.precall(args_)) return 0; + + ((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2)) + , c3(PyTuple_GET_ITEM(args_, 3)) + , c4(PyTuple_GET_ITEM(args_, 4)) + , c5(PyTuple_GET_ITEM(args_, 5))); - if (!policies.precall(args)) return 0; - - ((c0(PyTuple_GET_ITEM(args, 0))).*pmf)(c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2)), c3(PyTuple_GET_ITEM(args, 3)), c4(PyTuple_GET_ITEM(args, 4)), c5(PyTuple_GET_ITEM(args, 5))); - - return policies.postcall(args, detail::none()); + return policies.postcall(args_, detail::none()); } # endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - + template - static PyObject* call(R (*pf)(), PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (*pf)(), PyObject* args_, PyObject*, P const& policies) { - (*pf)(); - - return policies.postcall(args, detail::none()); + (*pf)( + ); + + return policies.postcall(args_, detail::none()); } template - static PyObject* call(R (*pf)(A0), PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (*pf)(A0), PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; + + if (!policies.precall(args_)) return 0; - if (!policies.precall(args)) return 0; - - (*pf)(c0(PyTuple_GET_ITEM(args, 0))); - - return policies.postcall(args, detail::none()); + (*pf)( + c0(PyTuple_GET_ITEM(args_, 0))); + + return policies.postcall(args_, detail::none()); } template - static PyObject* call(R (*pf)(A0, A1), PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (*pf)(A0, A1), PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; + + if (!policies.precall(args_)) return 0; - if (!policies.precall(args)) return 0; - - (*pf)(c0(PyTuple_GET_ITEM(args, 0)), c1(PyTuple_GET_ITEM(args, 1))); - - return policies.postcall(args, detail::none()); + (*pf)( + c0(PyTuple_GET_ITEM(args_, 0)) + , c1(PyTuple_GET_ITEM(args_, 1))); + + return policies.postcall(args_, detail::none()); } template - static PyObject* call(R (*pf)(A0, A1, A2), PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (*pf)(A0, A1, A2), PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; + + if (!policies.precall(args_)) return 0; - if (!policies.precall(args)) return 0; - - (*pf)(c0(PyTuple_GET_ITEM(args, 0)), c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2))); - - return policies.postcall(args, detail::none()); + (*pf)( + c0(PyTuple_GET_ITEM(args_, 0)) + , c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2))); + + return policies.postcall(args_, detail::none()); } template - static PyObject* call(R (*pf)(A0, A1, A2, A3), PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (*pf)(A0, A1, A2, A3), PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; - from_python c3(PyTuple_GET_ITEM(args, 3)); + from_python c3(PyTuple_GET_ITEM(args_, 3)); if (!c3.convertible()) return 0; + + if (!policies.precall(args_)) return 0; - if (!policies.precall(args)) return 0; - - (*pf)(c0(PyTuple_GET_ITEM(args, 0)), c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2)), c3(PyTuple_GET_ITEM(args, 3))); - - return policies.postcall(args, detail::none()); + (*pf)( + c0(PyTuple_GET_ITEM(args_, 0)) + , c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2)) + , c3(PyTuple_GET_ITEM(args_, 3))); + + return policies.postcall(args_, detail::none()); } template - static PyObject* call(R (*pf)(A0, A1, A2, A3, A4), PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (*pf)(A0, A1, A2, A3, A4), PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; - from_python c3(PyTuple_GET_ITEM(args, 3)); + from_python c3(PyTuple_GET_ITEM(args_, 3)); if (!c3.convertible()) return 0; - from_python c4(PyTuple_GET_ITEM(args, 4)); + from_python c4(PyTuple_GET_ITEM(args_, 4)); if (!c4.convertible()) return 0; + + if (!policies.precall(args_)) return 0; - if (!policies.precall(args)) return 0; - - (*pf)(c0(PyTuple_GET_ITEM(args, 0)), c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2)), c3(PyTuple_GET_ITEM(args, 3)), c4(PyTuple_GET_ITEM(args, 4))); - - return policies.postcall(args, detail::none()); + (*pf)( + c0(PyTuple_GET_ITEM(args_, 0)) + , c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2)) + , c3(PyTuple_GET_ITEM(args_, 3)) + , c4(PyTuple_GET_ITEM(args_, 4))); + + return policies.postcall(args_, detail::none()); } template - static PyObject* call(R (*pf)(A0, A1, A2, A3, A4, A5), PyObject* args, PyObject*, P const& policies) + static PyObject* call(R (*pf)(A0, A1, A2, A3, A4, A5), PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - from_python c0(PyTuple_GET_ITEM(args, 0)); + from_python c0(PyTuple_GET_ITEM(args_, 0)); if (!c0.convertible()) return 0; - from_python c1(PyTuple_GET_ITEM(args, 1)); + from_python c1(PyTuple_GET_ITEM(args_, 1)); if (!c1.convertible()) return 0; - from_python c2(PyTuple_GET_ITEM(args, 2)); + from_python c2(PyTuple_GET_ITEM(args_, 2)); if (!c2.convertible()) return 0; - from_python c3(PyTuple_GET_ITEM(args, 3)); + from_python c3(PyTuple_GET_ITEM(args_, 3)); if (!c3.convertible()) return 0; - from_python c4(PyTuple_GET_ITEM(args, 4)); + from_python c4(PyTuple_GET_ITEM(args_, 4)); if (!c4.convertible()) return 0; - from_python c5(PyTuple_GET_ITEM(args, 5)); + from_python c5(PyTuple_GET_ITEM(args_, 5)); if (!c5.convertible()) return 0; + + if (!policies.precall(args_)) return 0; - if (!policies.precall(args)) return 0; - - (*pf)(c0(PyTuple_GET_ITEM(args, 0)), c1(PyTuple_GET_ITEM(args, 1)), c2(PyTuple_GET_ITEM(args, 2)), c3(PyTuple_GET_ITEM(args, 3)), c4(PyTuple_GET_ITEM(args, 4)), c5(PyTuple_GET_ITEM(args, 5))); - - return policies.postcall(args, detail::none()); + (*pf)( + c0(PyTuple_GET_ITEM(args_, 0)) + , c1(PyTuple_GET_ITEM(args_, 1)) + , c2(PyTuple_GET_ITEM(args_, 2)) + , c3(PyTuple_GET_ITEM(args_, 3)) + , c4(PyTuple_GET_ITEM(args_, 4)) + , c5(PyTuple_GET_ITEM(args_, 5))); + + return policies.postcall(args_, detail::none()); } }; diff --git a/src/gen_returning.py b/src/gen_returning.py index 80e3342b..8f7c866c 100644 --- a/src/gen_returning.py +++ b/src/gen_returning.py @@ -1,4 +1,4 @@ -# (C) Copyright David Abrahams 2001. Permission to copy, use, modify, sell and +# (C) Copyright David Abrahams 2001,2002. Permission to copy, use, modify, sell and # distribute this software is granted provided this copyright notice appears # in all copies. This software is provided "as is" without express or implied # warranty, and with no claim as to its suitability for any purpose. @@ -8,8 +8,8 @@ from gen_function import * import string -header = '''// (C) Copyright David Abrahams 2001. Permission to copy, use, modify, sell and -// distribute this software is granted provided this copyright notice appears +header = '''// (C) Copyright David Abrahams 2001,2002. Permission to copy, use, modify, sell +// and distribute this software is granted provided this copyright notice appears // in all copies. This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -24,11 +24,10 @@ body_sections = ( #ifndef RETURNING_DWA20011201_HPP # define RETURNING_DWA20011201_HPP -//# include # include # include -# include # include +# include namespace boost { namespace python { namespace detail { @@ -62,32 +61,49 @@ struct returning #' -member_function = ''' template - static PyObject* call(R (A0::*pmf)(%(A%+%:, %))%1, PyObject* args, PyObject* /* keywords */ ) +member_function = ''' template + static PyObject* call(R (A0::*pmf)(%(A%+%:, %))%1, PyObject* args_, PyObject*, P const& policies) { // check that each of the arguments is convertible - unwrap c0(PyTuple_GET_ITEM(args, 0)); -%( unwrap_more c%+(PyTuple_GET_ITEM(args, %+), c%n); + from_python c0(PyTuple_GET_ITEM(args_, 0)); + if (!c0.convertible()) return 0; +%( from_python c%+(PyTuple_GET_ITEM(args_, %+)); + if (!c%+.convertible()) return 0; %) %[r%: // find the result converter - wrap_more r(c%n); -%] if (!c0) return 0; - %[r%:return r( %]((*c0).*pmf)(%(*c%+%:, %))%[r%: )%];%[v%: - return detail::none();%] + typedef typename P::result_converter result_converter; + typename eval::type cr; + if (!cr.convertible()) return 0; + +%] if (!policies.precall(args_)) return 0; + + %[r%:PyObject* result = cr( %]((c0(PyTuple_GET_ITEM(args_, 0)))->*pmf)( + %(c%+(PyTuple_GET_ITEM(args_, %+))%: + , %))%[r%: )%]; + + return policies.postcall(args_, %[r%:result%]%[v%:detail::none()%]); } ''' -free_function = '''%{ template <%(class A%n%:, %)> -%} static PyObject* call(R (*pf)(%(A%n%:, %)), PyObject*%{ args%}, PyObject* /* keywords */ ) +free_function = ''' template + static PyObject* call(R (*pf)(%(A%n%:, %)), PyObject* args_, PyObject*, P const& policies) {%{ // check that each of the arguments is convertible -%}%( unwrap%{_more%} c%n(PyTuple_GET_ITEM(args, %n)%{, c%-%}); -%)%[r%: - // find the result converter - wrap%{_more%} c%n%{(c%-)%};%]%[not-void-and-0-arg%: - if (!c0) return 0;%] - %[r%:return c%n( %](*pf)(%(*c%n%:, %))%[r%: )%];%[v%: - return detail::none();%] +%}%( from_python c%n(PyTuple_GET_ITEM(args_, %n)); + if (!c%n.convertible()) return 0; +%) +%[r%: // find the result converter + typedef typename P::result_converter result_converter; + typename eval::type cr; + if (!cr.convertible()) return 0; + +%]%[not-void-and-0-arg%: if (!policies.precall(args_)) return 0; + +%] %[r%:PyObject* result = cr( %](*pf)( + %(c%n(PyTuple_GET_ITEM(args_, %n))%: + , %))%[r%: )%]; + + return policies.postcall(args_, %[r%:result%]%[v%:detail::none()%]); } '''