Skip to content

Commit b97326f

Browse files
Cast to int.
1 parent 54b6192 commit b97326f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Objects/codeobject.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1849,8 +1849,9 @@ _PyCode_GetVarCounts(PyCodeObject *co, _PyCode_var_counts_t *counts)
18491849
assert(numfree == co->co_nfreevars);
18501850

18511851
// Get the unbound counts.
1852-
int numunbound = PyTuple_GET_SIZE(co->co_names);
1853-
assert(numunbound >= 0);
1852+
assert(PyTuple_GET_SIZE(co->co_names) >= 0);
1853+
assert(PyTuple_GET_SIZE(co->co_names) < INT_MAX);
1854+
int numunbound = (int)PyTuple_GET_SIZE(co->co_names);
18541855
struct co_unbound_counts unbound = {
18551856
.total = numunbound,
18561857
// numglobal and numattrs can be set later

0 commit comments

Comments
 (0)