2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-25 06:22:15 +00:00

Compare commits

..

1 Commits

Author SHA1 Message Date
nobody
8e0553b310 This commit was manufactured by cvs2svn to create tag
'Version_1_31_0'.

[SVN r22162]
2004-02-04 15:24:32 +00:00
3 changed files with 12 additions and 53 deletions

View File

@@ -83,9 +83,9 @@
interface applies to <code>array</code> instances as well.</p>
<p><a name="default_search"></a>The default behavior is to use
<code>numarray.NDArray</code> as the associated Python type if the
<code>numarray</code> module is installed in the default location.
Otherwise it falls back to use <code>Numeric.ArrayType</code>. If neither
<code>Numeric.ArrayType</code> as the associated Python type if the
<code>Numeric</code> module is installed in the default location.
Otherwise it falls back to use <code>numarray.NDArray</code>. If neither
extension module is installed, conversions to arguments of type
<code>numeric::array</code> will cause overload resolution to reject the
overload, and other attempted uses of <code>numeric::array</code> will <a

View File

@@ -570,40 +570,15 @@ namespace boost { namespace python { namespace detail {
base_get_slice_data(
Container& container, PySliceObject* slice, Index& from, Index& to)
{
if (Py_None != slice->step) {
PyErr_SetString( PyExc_IndexError, "slice step size not supported.");
throw_error_already_set();
}
Index min_index = DerivedPolicies::get_min_index(container);
Index max_index = DerivedPolicies::get_max_index(container);
if (Py_None == slice->start)
from = min_index;
else {
from = extract<long>( slice->start);
if (from < 0) // Negative slice index
from += max_index;
if (from < 0) // Clip lower bounds to zero
from = 0;
if (from > max_index) // Clip upper bounds to max_index.
from = max_index;
}
from = DerivedPolicies::get_min_index(container);
else
from = DerivedPolicies::convert_index(container, slice->start);
if (Py_None == slice->stop)
to = DerivedPolicies::get_max_index(container);
else {
to = extract<long>( slice->stop);
if (to < 0)
to += max_index;
if (to < 0)
to = 0;
if (to > max_index)
to = max_index;
}
else
to = DerivedPolicies::convert_index(container, slice->stop);
}
static void

View File

@@ -81,8 +81,6 @@ namespace boost { namespace python {
static object
get_slice(Container& container, index_type from, index_type to)
{
if (from > to)
return object(Container());
return object(Container(container.begin()+from, container.begin()+to));
}
@@ -96,13 +94,8 @@ namespace boost { namespace python {
set_slice(Container& container, index_type from,
index_type to, data_type const& v)
{
if (from > to) {
return;
}
else {
container.erase(container.begin()+from, container.begin()+to);
container.insert(container.begin()+from, v);
}
container.erase(container.begin()+from, container.begin()+to);
container.insert(container.begin()+from, v);
}
template <class Iter>
@@ -110,13 +103,8 @@ namespace boost { namespace python {
set_slice(Container& container, index_type from,
index_type to, Iter first, Iter last)
{
if (from > to) {
container.insert(container.begin()+from, first, last);
}
else {
container.erase(container.begin()+from, container.begin()+to);
container.insert(container.begin()+from, first, last);
}
container.erase(container.begin()+from, container.begin()+to);
container.insert(container.begin()+from, first, last);
}
static void
@@ -128,10 +116,6 @@ namespace boost { namespace python {
static void
delete_slice(Container& container, index_type from, index_type to)
{
if (from > to) {
// A null-op.
return;
}
container.erase(container.begin()+from, container.begin()+to);
}