Python use Py_ssize_t instead of int for better portability
This commit is contained in:
parent
3bfffab9f9
commit
c5322a9ecb
9 changed files with 50 additions and 63 deletions
|
|
@ -45,11 +45,10 @@
|
|||
return SWIG_NewPointerObj(new unordered_multimap_type(unordered_multimap), desc, SWIG_POINTER_OWN);
|
||||
} else {
|
||||
size_type size = unordered_multimap.size();
|
||||
int pysize = (size <= (size_type) INT_MAX) ? (int) size : -1;
|
||||
Py_ssize_t pysize = (size <= (size_type) INT_MAX) ? (Py_ssize_t) size : -1;
|
||||
if (pysize < 0) {
|
||||
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
|
||||
PyErr_SetString(PyExc_OverflowError,
|
||||
"unordered_multimap size not valid in python");
|
||||
PyErr_SetString(PyExc_OverflowError, "unordered_multimap size not valid in python");
|
||||
SWIG_PYTHON_THREAD_END_BLOCK;
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue