Ticket #4596: squash-64-bit-warnings-v2.patch

File squash-64-bit-warnings-v2.patch, 1.7 KB (added by Matthew Bradbury <matt-bradbury@…>, 12 years ago)

Using Py_ssize is probably better than just using long

  • boost/python/detail/caller.hpp

     
    5252
    5353inline unsigned arity(PyObject* const& args_)
    5454{
    55     return PyTuple_GET_SIZE(args_);
     55    return static_cast<unsigned>(PyTuple_GET_SIZE(args_));
    5656}
    5757
    5858// This "result converter" is really just used as
  • boost/python/suite/indexing/detail/indexing_suite_detail.hpp

     
    600600                from_ = min_index;
    601601            }
    602602            else {
    603                 long from = extract<long>( slice->start);
     603                Py_ssize_t from = extract<Py_ssize_t>(slice->start);
    604604                if (from < 0) // Negative slice index
    605                     from += max_index;
     605                    from += Py_ssize_t(max_index);
    606606                if (from < 0) // Clip lower bounds to zero
    607607                    from = 0;
    608608                from_ = boost::numeric_cast<Index>(from);
     
    614614                to_ = max_index;
    615615            }
    616616            else {
    617                 long to = extract<long>( slice->stop);
     617                Py_ssize_t to = extract<Py_ssize_t>(slice->stop);
    618618                if (to < 0)
    619                     to += max_index;
     619                    to += Py_ssize_t(max_index);
    620620                if (to < 0)
    621621                    to = 0;
    622622                to_ = boost::numeric_cast<Index>(to);