[pkg-boost-commits] r14459 - in boost/trunk/debian: . patches

Steven Michael Robbins smr at alioth.debian.org
Fri Jul 10 05:38:07 UTC 2009


Author: smr
Date: 2009-07-10 05:38:05 +0000 (Fri, 10 Jul 2009)
New Revision: 14459

Added:
   boost/trunk/debian/patches/python-enum-same-value.patch
   boost/trunk/debian/patches/python-generic-call.patch
Modified:
   boost/trunk/debian/changelog
   boost/trunk/debian/patches/series
Log:
Note google analytics removed from docs.  Add patches for Boost.Python: support enums with repeated values, and generic calls.

Modified: boost/trunk/debian/changelog
===================================================================
--- boost/trunk/debian/changelog	2009-07-10 03:50:20 UTC (rev 14458)
+++ boost/trunk/debian/changelog	2009-07-10 05:38:05 UTC (rev 14459)
@@ -6,10 +6,18 @@
     - patches/atomic_count_gcc.patch:
     - patches/library-naming.patch:
     - patches/sp_counted_base.patch: Remove.  Applied upstream.
+    - Google analytics code removed from docs.  Closes: #524186.
+
+  * patches/wave-cpp.patch: New.  Qualify std::string references.
   
-  * patches/wave-cpp.patch: New.  Qualify std::string references.
   * patches/bootstrap.patch: New.  Fix setting for LIBDIR.
+
+  * patches/python-generic-call.patch: New.  Add generic call operator
+    support.  Closes: #523344.
   
+  * patches/python-enum-same-value.patch: New.  Support enums with
+    duplicated values.  Closes: #523343.
+  
   * rules: Build using --layout=system, and only the variants normally
     built by upstream default (1 shared and 1 static variant).  System
     layout no longer has any decoration; i.e., neither -mt nor -mt-d.  Use

Added: boost/trunk/debian/patches/python-enum-same-value.patch
===================================================================
--- boost/trunk/debian/patches/python-enum-same-value.patch	                        (rev 0)
+++ boost/trunk/debian/patches/python-enum-same-value.patch	2009-07-10 05:38:05 UTC (rev 14459)
@@ -0,0 +1,113 @@
+Debian bug #523343
+Reported upstream as https://svn.boost.org/trac/boost/ticket/2744
+This fix is upstream changeset https://svn.boost.org/trac/boost/changeset/53660
+
+--- boost1.39-1.39.0.orig/libs/python/src/object/enum.cpp
++++ boost1.39-1.39.0/libs/python/src/object/enum.cpp
+@@ -139,6 +139,7 @@
+       dict d;
+       d["__slots__"] = tuple();
+       d["values"] = dict();
++      d["names"] = dict();
+ 
+       object module_name = module_prefix();
+       if (module_name)
+@@ -191,18 +192,19 @@
+     enum_object* p = downcast<enum_object>(x.ptr());
+     Py_XDECREF(p->name);
+     p->name = incref(name.ptr());
++
++    dict names_dict = extract<dict>(this->attr("names"))();
++    names_dict[x.attr("name")] = x;
+ }
+ 
+ void enum_base::export_values()
+ {
+-    dict d = extract<dict>(this->attr("values"))();
+-    list values = d.values();
++    dict d = extract<dict>(this->attr("names"))();
++    list items = d.items();
+     scope current;
+-    
+-    for (unsigned i = 0, max = len(values); i < max; ++i)
+-    {
+-        api::setattr(current, object(values[i].attr("name")), values[i]);
+-    }
++
++    for (unsigned i = 0, max = len(items); i < max; ++i)
++        api::setattr(current, items[i][0], items[i][1]);
+  }
+ 
+ PyObject* enum_base::to_python(PyTypeObject* type_, long x)
+--- boost1.39-1.39.0.orig/libs/python/test/enum.cpp
++++ boost1.39-1.39.0/libs/python/test/enum.cpp
+@@ -12,7 +12,7 @@
+ #endif 
+ using namespace boost::python;
+ 
+-enum color { red = 1, green = 2, blue = 4 };
++enum color { red = 1, green = 2, blue = 4, blood = 1 };
+ 
+ #if BOOST_WORKAROUND(__MWERKS__, <= 0x2407)
+ namespace boost  // Pro7 has a hard time detecting enums
+@@ -34,6 +34,7 @@
+         .value("red", red)
+         .value("green", green)
+         .value("blue", blue)
++        .value("blood", blood)
+         .export_values()
+         ;
+     
+--- boost1.39-1.39.0.orig/libs/python/test/enum.py
++++ boost1.39-1.39.0/libs/python/test/enum.py
+@@ -4,8 +4,8 @@
+ '''
+ >>> from enum_ext import *
+ 
+->>> identity(color.red)
+-enum_ext.color.red
++>>> identity(color.red) # in case of duplicated enums it always take the last enum
++enum_ext.color.blood
+ 
+ >>> identity(color.green)
+ enum_ext.color.green
+@@ -13,8 +13,8 @@
+ >>> identity(color.blue)
+ enum_ext.color.blue
+ 
+->>> identity(color(1))
+-enum_ext.color.red
++>>> identity(color(1)) # in case of duplicated enums it always take the last enum
++enum_ext.color.blood
+ 
+ >>> identity(color(2))
+ enum_ext.color.green
+@@ -28,7 +28,7 @@
+   --- check export to scope ---
+ 
+ >>> identity(red)
+-enum_ext.color.red
++enum_ext.color.blood
+ 
+ >>> identity(green)
+ enum_ext.color.green
+@@ -42,10 +42,18 @@
+ 
+ >>> c = colorized()
+ >>> c.x
+-enum_ext.color.red
++enum_ext.color.blood
+ >>> c.x = green
+ >>> c.x
+ enum_ext.color.green
++>>> red == blood
++True
++>>> red == green
++False
++>>> hash(red) == hash(blood)
++True
++>>> hash(red) == hash(green)
++False
+ '''
+ 
+ # pickling of enums only works with Python 2.3 or higher

Added: boost/trunk/debian/patches/python-generic-call.patch
===================================================================
--- boost/trunk/debian/patches/python-generic-call.patch	                        (rev 0)
+++ boost/trunk/debian/patches/python-generic-call.patch	2009-07-10 05:38:05 UTC (rev 14459)
@@ -0,0 +1,171 @@
+Debian bug 523344
+Patch from upstream https://svn.boost.org/trac/boost/changeset/47846
+
+--- boost1.39-1.39.0.orig/boost/python/object_core.hpp
++++ boost1.39-1.39.0/boost/python/object_core.hpp
+@@ -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 @@
+ 
+ # 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 @@
+ // 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))
+ {}
+--- boost1.39-1.39.0.orig/libs/python/doc/v2/object.html
++++ boost1.39-1.39.0/libs/python/doc/v2/object.html
+@@ -655,6 +655,11 @@
+       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 @@
+       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>
+--- boost1.39-1.39.0.orig/libs/python/test/object.cpp
++++ boost1.39-1.39.0/libs/python/test/object.cpp
+@@ -187,6 +187,11 @@
+     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 @@
+     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);
+--- boost1.39-1.39.0.orig/libs/python/test/object.py
++++ boost1.39-1.39.0/libs/python/test/object.py
+@@ -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

Modified: boost/trunk/debian/patches/series
===================================================================
--- boost/trunk/debian/patches/series	2009-07-10 03:50:20 UTC (rev 14458)
+++ boost/trunk/debian/patches/series	2009-07-10 05:38:05 UTC (rev 14459)
@@ -1,3 +1,5 @@
+python-enum-same-value.patch
+python-generic-call.patch
 bootstrap.patch
 boost-python-examples.patch
 endian.patch




More information about the pkg-boost-commits mailing list