|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r74931 - in branches/release: boost/python boost/python/detail boost/python/object libs/python libs/python/doc/v2 libs/python/src/object libs/python/test
From: rwgk_at_[hidden]
Date: 2011-10-12 17:38:54
Author: rwgk
Date: 2011-10-12 17:38:53 EDT (Wed, 12 Oct 2011)
New Revision: 74931
URL: http://svn.boost.org/trac/boost/changeset/74931
Log:
merging current boost/python and libs/python from trunk into release branch
Properties modified:
branches/release/boost/python/ (props changed)
branches/release/libs/python/ (props changed)
Text files modified:
branches/release/boost/python/class.hpp | 3 ++-
branches/release/boost/python/detail/make_keyword_range_fn.hpp | 2 +-
branches/release/boost/python/object/class_metadata.hpp | 6 +++---
branches/release/boost/python/object/make_holder.hpp | 4 ++--
branches/release/boost/python/slice.hpp | 16 +++++++++++++---
branches/release/libs/python/doc/v2/slice.html | 14 +++++++-------
branches/release/libs/python/doc/v2/with_custodian_and_ward.html | 2 +-
branches/release/libs/python/src/object/function.cpp | 10 +++++-----
branches/release/libs/python/test/slice.cpp | 8 ++++----
branches/release/libs/python/test/slice.py | 12 ++++++------
10 files changed, 44 insertions(+), 33 deletions(-)
Modified: branches/release/boost/python/class.hpp
==============================================================================
--- branches/release/boost/python/class.hpp (original)
+++ branches/release/boost/python/class.hpp 2011-10-12 17:38:53 EDT (Wed, 12 Oct 2011)
@@ -138,7 +138,8 @@
static void
must_be_derived_class_member(Default const&)
{
- typedef typename assertion<mpl::not_<is_same<Default,Fn> > >::failed test0;
+ // https://svn.boost.org/trac/boost/ticket/5803
+ //typedef typename assertion<mpl::not_<is_same<Default,Fn> > >::failed test0;
# if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407)
typedef typename assertion<is_polymorphic<T> >::failed test1;
# endif
Modified: branches/release/boost/python/detail/make_keyword_range_fn.hpp
==============================================================================
--- branches/release/boost/python/detail/make_keyword_range_fn.hpp (original)
+++ branches/release/boost/python/detail/make_keyword_range_fn.hpp 2011-10-12 17:38:53 EDT (Wed, 12 Oct 2011)
@@ -57,7 +57,7 @@
, Holder* = 0
, ArgList* = 0, Arity* = 0)
{
-#if !defined( BOOST_PYTHON_NO_PY_SIGNATURES) && defined( BOOST_PYTHON_PY_SYGNATURES_PROPER_INIT_SELF_TYPE)
+#if !defined( BOOST_PYTHON_NO_PY_SIGNATURES) && defined( BOOST_PYTHON_PY_SIGNATURES_PROPER_INIT_SELF_TYPE)
python_class<BOOST_DEDUCED_TYPENAME Holder::value_type>::register_();
#endif
return detail::make_keyword_range_function(
Modified: branches/release/boost/python/object/class_metadata.hpp
==============================================================================
--- branches/release/boost/python/object/class_metadata.hpp (original)
+++ branches/release/boost/python/object/class_metadata.hpp 2011-10-12 17:38:53 EDT (Wed, 12 Oct 2011)
@@ -238,7 +238,7 @@
//
inline static void maybe_register_pointer_to_python(...) {}
-#ifndef BOOST_PYTHON_NO_PY_SYGNATURES
+#ifndef BOOST_PYTHON_NO_PY_SIGNATURES
inline static void maybe_register_pointer_to_python(void*,void*,mpl::true_*)
{
objects::copy_class_object(python::type_id<T>(), python::type_id<back_reference<T const &> >());
@@ -255,7 +255,7 @@
, make_ptr_instance<T2, pointer_holder<held_type, T2> >
>()
);
-#ifndef BOOST_PYTHON_NO_PY_SYGNATURES
+#ifndef BOOST_PYTHON_NO_PY_SIGNATURES
// explicit qualification of type_id makes msvc6 happy
objects::copy_class_object(python::type_id<T2>(), python::type_id<held_type>());
#endif
@@ -270,7 +270,7 @@
inline static void maybe_register_class_to_python(T2*, mpl::false_)
{
python::detail::force_instantiate(class_cref_wrapper<T2, make_instance<T2, holder> >());
-#ifndef BOOST_PYTHON_NO_PY_SYGNATURES
+#ifndef BOOST_PYTHON_NO_PY_SIGNATURES
// explicit qualification of type_id makes msvc6 happy
objects::copy_class_object(python::type_id<T2>(), python::type_id<held_type>());
#endif
Modified: branches/release/boost/python/object/make_holder.hpp
==============================================================================
--- branches/release/boost/python/object/make_holder.hpp (original)
+++ branches/release/boost/python/object/make_holder.hpp 2011-10-12 17:38:53 EDT (Wed, 12 Oct 2011)
@@ -12,7 +12,7 @@
# include <boost/python/object/instance.hpp>
# include <boost/python/converter/registry.hpp>
-#if !defined( BOOST_PYTHON_NO_PY_SIGNATURES) && defined( BOOST_PYTHON_PY_SYGNATURES_PROPER_INIT_SELF_TYPE)
+#if !defined( BOOST_PYTHON_NO_PY_SIGNATURES) && defined( BOOST_PYTHON_PY_SIGNATURES_PROPER_INIT_SELF_TYPE)
# include <boost/python/detail/python_type.hpp>
#endif
@@ -81,7 +81,7 @@
# endif
static void execute(
-#if !defined( BOOST_PYTHON_NO_PY_SIGNATURES) && defined( BOOST_PYTHON_PY_SYGNATURES_PROPER_INIT_SELF_TYPE)
+#if !defined( BOOST_PYTHON_NO_PY_SIGNATURES) && defined( BOOST_PYTHON_PY_SIGNATURES_PROPER_INIT_SELF_TYPE)
boost::python::detail::python_class<BOOST_DEDUCED_TYPENAME Holder::value_type> *p
#else
PyObject *p
Modified: branches/release/boost/python/slice.hpp
==============================================================================
--- branches/release/boost/python/slice.hpp (original)
+++ branches/release/boost/python/slice.hpp 2011-10-12 17:38:53 EDT (Wed, 12 Oct 2011)
@@ -30,7 +30,7 @@
// that created this slice, than that parameter is None here, and compares
// equal to a default-constructed boost::python::object.
// If a user-defined type wishes to support slicing, then support for the
- // special meaning associated with negative indicies is up to the user.
+ // special meaning associated with negative indices is up to the user.
object start() const;
object stop() const;
object step() const;
@@ -63,7 +63,7 @@
// The following algorithm is intended to automate the process of
// determining a slice range when you want to fully support negative
- // indicies and non-singular step sizes. Its functionallity is simmilar to
+ // indices and non-singular step sizes. Its functionallity is simmilar to
// PySlice_GetIndicesEx() in the Python/C API, but tailored for C++ users.
// This template returns a slice::range struct that, when used in the
// following iterative loop, will traverse a slice of the function's
@@ -110,7 +110,7 @@
template<typename RandomAccessIterator>
slice::range<RandomAccessIterator>
- get_indicies( const RandomAccessIterator& begin,
+ get_indices( const RandomAccessIterator& begin,
const RandomAccessIterator& end) const
{
// This is based loosely on PySlice_GetIndicesEx(), but it has been
@@ -240,6 +240,16 @@
return ret;
}
+
+ // Incorrect spelling. DO NOT USE. Only here for backward compatibility.
+ // Corrected 2011-06-14.
+ template<typename RandomAccessIterator>
+ slice::range<RandomAccessIterator>
+ get_indicies( const RandomAccessIterator& begin,
+ const RandomAccessIterator& end) const
+ {
+ get_indices(begin, end);
+ }
public:
// This declaration, in conjunction with the specialization of
Modified: branches/release/libs/python/doc/v2/slice.html
==============================================================================
--- branches/release/libs/python/doc/v2/slice.html (original)
+++ branches/release/libs/python/doc/v2/slice.html 2011-10-12 17:38:53 EDT (Wed, 12 Oct 2011)
@@ -85,7 +85,7 @@
object stop();
object step();
- // The return type of slice::get_indicies()
+ // The return type of slice::get_indices()
template <typename RandomAccessIterator>
struct range
{
@@ -96,7 +96,7 @@
template <typename RandomAccessIterator>
range<RandomAccessIterator>
- get_indicies(
+ get_indices(
RandomAccessIterator const& begin,
RandomAccessIterator const& end);
};
@@ -164,7 +164,7 @@
<pre>
template <typename RandomAccessIterator>
slice::range<RandomAccessIterator>
-slice::get_indicies(
+slice::get_indices(
RandomAccessIterator const& begin,
RandomAccessIterator const& end) const;
</pre>
@@ -173,8 +173,8 @@
Iterators that form a half-open range.</dt>
<dt><b>Effects:</b> Create a RandomAccessIterator pair that defines a
fully-closed range within the [begin,end) range of its arguments.
-This function translates this slice's indicies while accounting for the
-effects of any PyNone or negative indicies, and non-singular step sizes.</dt>
+This function translates this slice's indices while accounting for the
+effects of any PyNone or negative indices, and non-singular step sizes.</dt>
<dt><b>Returns:</b> a slice::range
that has been initialized with a non-zero value of step and a pair of
RandomAccessIterators that point within the range of this functions
@@ -182,7 +182,7 @@
<dt><b>Throws:</b> Raises a Python <code>TypeError</code> exception if any of this slice's arguments
are neither references to <code>PyNone</code> nor convertible to <code>int</code>. Throws
<code>std::invalid_argument</code> if the resulting range would be empty. You
-should always wrap calls to <code>slice::get_indicies()</code>
+should always wrap calls to <code>slice::get_indices()</code>
within <code>try { ...; } catch (std::invalid_argument) {}</code> to
handle this case and take appropriate action.</dt>
<dt><b>Rationale</b>: closed-interval: If
@@ -221,7 +221,7 @@
{
slice::range<std::vector<double>::const_iterator> bounds;
try {
- bounds = index.get_indicies<>(Foo.begin(), Foo.end());
+ bounds = index.get_indices<>(Foo.begin(), Foo.end());
}
catch (std::invalid_argument) {
return 0.0;
Modified: branches/release/libs/python/doc/v2/with_custodian_and_ward.html
==============================================================================
--- branches/release/libs/python/doc/v2/with_custodian_and_ward.html (original)
+++ branches/release/libs/python/doc/v2/with_custodian_and_ward.html 2011-10-12 17:38:53 EDT (Wed, 12 Oct 2011)
@@ -91,7 +91,7 @@
<hr>
<h2>
<a name="introduction">Introduction</a>
- </h2>This header provides faciliites for establishing a lifetime
+ </h2>This header provides facilities for establishing a lifetime
dependency between two of a function's Python argument or result objects.
The <i>ward</i> object will not be destroyed until after the custodian as
long as the <i>custodian</i> object supports <a href=
Modified: branches/release/libs/python/src/object/function.cpp
==============================================================================
--- branches/release/libs/python/src/object/function.cpp (original)
+++ branches/release/libs/python/src/object/function.cpp 2011-10-12 17:38:53 EDT (Wed, 12 Oct 2011)
@@ -433,23 +433,23 @@
if (attribute.ptr()->ob_type == &function_type)
{
function* new_func = downcast<function>(attribute.ptr());
- PyObject* dict = 0;
+ handle<> dict;
#if PY_VERSION_HEX < 0x03000000
// Old-style class gone in Python 3
if (PyClass_Check(ns))
- dict = ((PyClassObject*)ns)->cl_dict;
+ dict = handle<>(borrowed(((PyClassObject*)ns)->cl_dict));
else
#endif
if (PyType_Check(ns))
- dict = ((PyTypeObject*)ns)->tp_dict;
+ dict = handle<>(borrowed(((PyTypeObject*)ns)->tp_dict));
else
- dict = PyObject_GetAttrString(ns, const_cast<char*>("__dict__"));
+ dict = handle<>(PyObject_GetAttrString(ns, const_cast<char*>("__dict__")));
if (dict == 0)
throw_error_already_set();
- handle<> existing(allow_null(::PyObject_GetItem(dict, name.ptr())));
+ handle<> existing(allow_null(::PyObject_GetItem(dict.get(), name.ptr())));
if (existing)
{
Modified: branches/release/libs/python/test/slice.cpp
==============================================================================
--- branches/release/libs/python/test/slice.cpp (original)
+++ branches/release/libs/python/test/slice.cpp 2011-10-12 17:38:53 EDT (Wed, 12 Oct 2011)
@@ -98,9 +98,9 @@
#if BOOST_WORKAROUND( BOOST_MSVC, BOOST_TESTED_AT(1400)) \
|| BOOST_WORKAROUND( BOOST_INTEL_WIN, == 710)
-int check_slice_get_indicies(slice index);
+int check_slice_get_indices(slice index);
#endif
-int check_slice_get_indicies(
+int check_slice_get_indices(
#if !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))
const
#endif
@@ -116,7 +116,7 @@
slice::range<std::vector<int>::iterator> bounds;
try {
- bounds = index.get_indicies(coll.begin(), coll.end());
+ bounds = index.get_indices(coll.begin(), coll.end());
}
catch (std::invalid_argument) {
return 0;
@@ -136,5 +136,5 @@
def( "accept_slice", accept_slice);
def( "check_numeric_array_rich_slice", check_numeric_array_rich_slice);
def( "check_string_rich_slice", check_string_rich_slice);
- def( "check_slice_get_indicies", check_slice_get_indicies);
+ def( "check_slice_get_indices", check_slice_get_indices);
}
Modified: branches/release/libs/python/test/slice.py
==============================================================================
--- branches/release/libs/python/test/slice.py (original)
+++ branches/release/libs/python/test/slice.py 2011-10-12 17:38:53 EDT (Wed, 12 Oct 2011)
@@ -37,17 +37,17 @@
... print 1
...
1
->>> check_slice_get_indicies( slice(None))
+>>> check_slice_get_indices( slice(None))
0
->>> check_slice_get_indicies( slice(2,-2))
+>>> check_slice_get_indices( slice(2,-2))
0
->>> check_slice_get_indicies( slice(2, None, 2))
+>>> check_slice_get_indices( slice(2, None, 2))
5
->>> check_slice_get_indicies( slice(2, None, -1))
+>>> check_slice_get_indices( slice(2, None, -1))
-12
->>> check_slice_get_indicies( slice( 20, None))
+>>> check_slice_get_indices( slice( 20, None))
0
->>> check_slice_get_indicies( slice( -2, -5, -2))
+>>> check_slice_get_indices( slice( -2, -5, -2))
6
"""
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk