diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2018-01-18 10:15:25 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-18 10:15:25 (GMT) |
commit | 05d68a8bd84cb141be9f9335f5b3540f15a989c4 (patch) | |
tree | a4e48a3b3c5b46422f83ffb9b4314eb8ea344325 /Modules/clinic/gcmodule.c.h | |
parent | ab74504346a6e2569b3255b7b621c589716888c4 (diff) | |
download | cpython-05d68a8bd84cb141be9f9335f5b3540f15a989c4.zip cpython-05d68a8bd84cb141be9f9335f5b3540f15a989c4.tar.gz cpython-05d68a8bd84cb141be9f9335f5b3540f15a989c4.tar.bz2 |
bpo-9566: Fix size_t=>int downcast warnings (#5230)
* Use wider types (int => Py_ssize_t) to avoid integer overflows.
* Fix gc.get_freeze_count(): use Py_ssize_t type rather than int, since gc_list_size() returns a Py_ssize_t.
Diffstat (limited to 'Modules/clinic/gcmodule.c.h')
-rw-r--r-- | Modules/clinic/gcmodule.c.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Modules/clinic/gcmodule.c.h b/Modules/clinic/gcmodule.c.h index c431af7..0330c81 100644 --- a/Modules/clinic/gcmodule.c.h +++ b/Modules/clinic/gcmodule.c.h @@ -307,22 +307,22 @@ PyDoc_STRVAR(gc_get_freeze_count__doc__, #define GC_GET_FREEZE_COUNT_METHODDEF \ {"get_freeze_count", (PyCFunction)gc_get_freeze_count, METH_NOARGS, gc_get_freeze_count__doc__}, -static int +static Py_ssize_t gc_get_freeze_count_impl(PyObject *module); static PyObject * gc_get_freeze_count(PyObject *module, PyObject *Py_UNUSED(ignored)) { PyObject *return_value = NULL; - int _return_value; + Py_ssize_t _return_value; _return_value = gc_get_freeze_count_impl(module); if ((_return_value == -1) && PyErr_Occurred()) { goto exit; } - return_value = PyLong_FromLong((long)_return_value); + return_value = PyLong_FromSsize_t(_return_value); exit: return return_value; } -/*[clinic end generated code: output=6f9ee4d8dd1f36c1 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=21dc9270b10b7891 input=a9049054013a1b77]*/ |