File boost-add_generic_call-operator_support.patch of Package boost-openSUSE_Factory

Index: boost/python/object_core.hpp
===================================================================
--- boost/python/object_core.hpp.orig	2008-07-15 22:05:24.000000000 +0100
+++ boost/python/object_core.hpp	2010-01-24 16:49:12.500021750 +0000
@@ -42,6 +42,12 @@
 
 namespace boost { namespace python { 
 
+namespace detail
+{
+  class kwds_proxy; 
+  class args_proxy; 
+} 
+
 namespace converter
 {
   template <class T> struct arg_to_python;
@@ -102,6 +108,11 @@ namespace api
 
 # define BOOST_PP_ITERATION_PARAMS_1 (3, (1, BOOST_PYTHON_MAX_ARITY, <boost/python/object_call.hpp>))
 # include BOOST_PP_ITERATE()
+    
+      detail::args_proxy operator* () const; 
+      object operator()(detail::args_proxy const &args) const; 
+      object operator()(detail::args_proxy const &args, 
+                        detail::kwds_proxy const &kwds) const; 
 
       // truth value testing
       //
@@ -416,6 +427,62 @@ template <class T> struct extract;
 // implementation
 //
 
+namespace detail 
+{
+
+class call_proxy 
+{ 
+public: 
+  call_proxy(object target) : m_target(target) {} 
+  operator object() const { return m_target;} 
+ 
+ private: 
+    object m_target; 
+}; 
+ 
+class kwds_proxy : public call_proxy 
+{ 
+public: 
+  kwds_proxy(object o = object()) : call_proxy(o) {} 
+}; 
+class args_proxy : public call_proxy 
+{ 
+public: 
+  args_proxy(object o) : call_proxy(o) {} 
+  kwds_proxy operator* () const { return kwds_proxy(*this);} 
+}; 
+} 
+ 
+template <typename U> 
+detail::args_proxy api::object_operators<U>::operator* () const 
+{ 
+  object_cref2 x = *static_cast<U const*>(this); 
+  return detail::args_proxy(x); 
+} 
+ 
+template <typename U> 
+object api::object_operators<U>::operator()(detail::args_proxy const &args) const 
+{ 
+  U const& self = *static_cast<U const*>(this); 
+  PyObject *result = PyObject_Call(get_managed_object(self, tag), 
+                                   args.operator object().ptr(), 
+                                   0); 
+  return object(detail::new_reference(result)); 
+ 
+} 
+ 
+template <typename U> 
+object api::object_operators<U>::operator()(detail::args_proxy const &args, 
+                                            detail::kwds_proxy const &kwds) const 
+{ 
+  U const& self = *static_cast<U const*>(this); 
+  PyObject *result = PyObject_Call(get_managed_object(self, tag), 
+                                   args.operator object().ptr(), 
+                                   kwds.operator object().ptr()); 
+  return object(detail::new_reference(result)); 
+ 
+}  
+
 inline object::object()
     : object_base(python::incref(Py_None))
 {}
Index: libs/python/doc/v2/object.html
===================================================================
--- libs/python/doc/v2/object.html.orig	2008-07-15 22:05:24.000000000 +0100
+++ libs/python/doc/v2/object.html	2010-01-24 16:49:12.504007173 +0000
@@ -655,6 +655,11 @@ namespace boost { namespace python { nam
       template &lt;class A0, class A1,...class An&gt;
       object operator()(A0 const&amp;, A1 const&amp;,...An const&amp;) const;
 
+      detail::args_proxy operator* () const; 
+      object operator()(detail::args_proxy const &amp;args) const; 
+      object operator()(detail::args_proxy const &amp;args, 
+                        detail::kwds_proxy const &amp;kwds) const; 
+
       // truth value testing
       //
       typedef unspecified bool_type;
@@ -704,6 +709,25 @@ object operator()(A0 const&amp; a1, A1 c
       call&lt;object&gt;(object(*static_cast&lt;U*&gt;(this)).ptr(), a1,
       a2,...aN)</dt>
     </dl>
+
+<pre>
+object operator()(detail::args_proxy const &amp;args) const; 
+</pre>
+<dl class="function-semantics">
+  <dt><b>Effects:</b>
+  call object with arguments given by the tuple <varname>args</varname></dt>
+</dl>
+<pre>
+object operator()(detail::args_proxy const &amp;args, 
+                  detail::kwds_proxy const &amp;kwds) const; 
+</pre>
+<dl class="function-semantics">
+  <dt><b>Effects:</b>
+  call object with arguments given by the tuple <varname>args</varname>, and named
+  arguments given by the dictionary <varname>kwds</varname></dt>
+</dl>
+
+
 <pre>
 operator bool_type() const;
 </pre>
Index: libs/python/test/object.cpp
===================================================================
--- libs/python/test/object.cpp.orig	2008-07-15 22:05:24.000000000 +0100
+++ libs/python/test/object.cpp	2010-01-24 16:49:12.508161542 +0000
@@ -187,6 +187,11 @@ bool check_string_slice()
     return s.slice(2,-1).slice(1,-1)  == "lo, wor";
 }
 
+object test_call(object c, object args, object kwds) 
+{ 
+    return c(*args, **kwds); 
+} 
+
 bool check_binary_operators()
 {
     int y;
@@ -377,6 +382,7 @@ BOOST_PYTHON_MODULE(object_ext)
     def("test_item", test_item);
     def("test_not_item", test_not_item);
 
+    def("test_call", test_call);
     def("check_binary_operators", check_binary_operators);
     def("check_inplace", check_inplace);
     def("check_string_slice", check_string_slice);
Index: libs/python/test/object.py
===================================================================
--- libs/python/test/object.py.orig	2008-07-15 22:05:24.000000000 +0100
+++ libs/python/test/object.py	2010-01-24 16:49:12.508161542 +0000
@@ -134,7 +134,12 @@
 
         Operators
 
-        
+>>> def print_args(*args, **kwds): 
+...     print args, kwds 
+>>> test_call(print_args, (0, 1, 2, 3), {'a':'A'}) 
+(0, 1, 2, 3) {'a': 'A'}
+
+
 >>> assert check_binary_operators()
 
 >>> class X: pass