|
14 | 14 | #include <boost/python/extract.hpp> |
15 | 15 | #include <boost/python/tuple.hpp> |
16 | 16 | #include <boost/python/list.hpp> |
| 17 | +#include <boost/python/ssize_t.hpp> |
17 | 18 |
|
18 | 19 | #include <boost/python/detail/signature.hpp> |
19 | 20 | #include <boost/mpl/vector/vector10.hpp> |
@@ -64,7 +65,7 @@ function::function( |
64 | 65 | = max_arity > num_keywords ? max_arity - num_keywords : 0; |
65 | 66 |
|
66 | 67 |
|
67 | | - unsigned tuple_size = num_keywords ? max_arity : 0; |
| 68 | + ssize_t tuple_size = num_keywords ? max_arity : 0; |
68 | 69 | m_arg_names = object(handle<>(PyTuple_New(tuple_size))); |
69 | 70 |
|
70 | 71 | if (num_keywords != 0) |
@@ -158,7 +159,9 @@ PyObject* function::call(PyObject* args, PyObject* keywords) const |
158 | 159 | else |
159 | 160 | { |
160 | 161 | // build a new arg tuple, will adjust its size later |
161 | | - inner_args = handle<>(PyTuple_New(max_arity)); |
| 162 | + assert(max_arity <= ssize_t_max); |
| 163 | + inner_args = handle<>( |
| 164 | + PyTuple_New(static_cast<ssize_t>(max_arity))); |
162 | 165 |
|
163 | 166 | // Fill in the positional arguments |
164 | 167 | for (std::size_t i = 0; i < n_unnamed_actual; ++i) |
@@ -293,7 +296,7 @@ void function::argument_error(PyObject* args, PyObject* /*keywords*/) const |
293 | 296 | % make_tuple(this->m_namespace, this->m_name); |
294 | 297 |
|
295 | 298 | list actual_args; |
296 | | - for (int i = 0; i < PyTuple_Size(args); ++i) |
| 299 | + for (ssize_t i = 0; i < PyTuple_Size(args); ++i) |
297 | 300 | { |
298 | 301 | char const* name = PyTuple_GetItem(args, i)->ob_type->tp_name; |
299 | 302 | actual_args.append(str(name)); |
|
0 commit comments