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.
This commit is contained in:
Victor Stinner 2018-01-18 11:15:25 +01:00 committed by GitHub
parent ab74504346
commit 05d68a8bd8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 14 deletions

View file

@ -1449,14 +1449,14 @@ gc_unfreeze_impl(PyObject *module)
}
/*[clinic input]
gc.get_freeze_count -> int
gc.get_freeze_count -> Py_ssize_t
Return the number of objects in the permanent generation.
[clinic start generated code]*/
static int
static Py_ssize_t
gc_get_freeze_count_impl(PyObject *module)
/*[clinic end generated code: output=e4e2ebcc77e5cbf3 input=4b759db880a3c6e4]*/
/*[clinic end generated code: output=61cbd9f43aa032e1 input=45ffbc65cfe2a6ed]*/
{
return gc_list_size(&_PyRuntime.gc.permanent_generation.head);
}