1111# include < boost/scoped_ptr.hpp>
1212# include < boost/get_pointer.hpp>
1313# include < boost/detail/binary_search.hpp>
14+ # include < boost/cast.hpp>
1415# include < vector>
1516# include < map>
1617#include < iostream>
@@ -569,7 +570,7 @@ namespace boost { namespace python { namespace detail {
569570
570571 static void
571572 base_get_slice_data (
572- Container& container, PySliceObject* slice, Index& from , Index& to )
573+ Container& container, PySliceObject* slice, Index& from_ , Index& to_ )
573574 {
574575 if (Py_None != slice->step ) {
575576 PyErr_SetString ( PyExc_IndexError, " slice step size not supported." );
@@ -579,34 +580,33 @@ namespace boost { namespace python { namespace detail {
579580 Index min_index = DerivedPolicies::get_min_index (container);
580581 Index max_index = DerivedPolicies::get_max_index (container);
581582
582-
583583 if (Py_None == slice->start ) {
584- from = min_index;
584+ from_ = min_index;
585585 }
586586 else {
587- from = extract<long >( slice->start );
587+ long from = extract<long >( slice->start );
588588 if (from < 0 ) // Negative slice index
589589 from += max_index;
590590 if (from < 0 ) // Clip lower bounds to zero
591591 from = 0 ;
592592 if (from > max_index) // Clip upper bounds to max_index.
593593 from = max_index;
594-
594+ from_ = boost::numeric_cast<Index>(from);
595595 }
596596
597597 if (Py_None == slice->stop ) {
598- to = DerivedPolicies::get_max_index (container) ;
598+ to_ = max_index ;
599599 }
600600 else {
601- to = extract<long >( slice->stop );
601+ long to = extract<long >( slice->stop );
602602 if (to < 0 )
603603 to += max_index;
604604 if (to < 0 )
605605 to = 0 ;
606606 if (to > max_index)
607607 to = max_index;
608+ to_ = boost::numeric_cast<Index>(to);
608609 }
609-
610610 }
611611
612612 static void
0 commit comments