Commit c48c8db1 authored by Martin v. Löwis's avatar Martin v. Löwis

Add PY_SSIZE_T_MIN, as suggested by Ralf W. Grosse-Kunstleve.

parent 726dcf34
......@@ -99,6 +99,8 @@ typedef Py_intptr_t Py_ssize_t;
/* Largest positive value of type Py_ssize_t. */
#define PY_SSIZE_T_MAX ((Py_ssize_t)(((size_t)-1)>>1))
/* Smallest positive value of type Py_ssize_t. */
#define PY_SSIZE_T_MIN (-PY_SSIZE_T_MAX-1)
/* PY_FORMAT_SIZE_T is a platform-specific modifier for use in a printf
* format to convert an argument with the width of a size_t or Py_ssize_t.
......
......@@ -281,7 +281,7 @@ _long_as_ssize_t(PyObject *vv) {
if (sign > 0)
return PY_SSIZE_T_MAX;
else
return -PY_SSIZE_T_MAX-1;
return PY_SSIZE_T_MIN;
}
/* Get a Py_ssize_t from a long int object.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment