Skip to content

Commit 54b6192

Browse files
Avoid casting to int.
1 parent d9c3672 commit 54b6192

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Objects/codeobject.c

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

18511851
// Get the unbound counts.
1852-
assert(PyTuple_GET_SIZE(co->co_names) >= 0);
1852+
int numunbound = PyTuple_GET_SIZE(co->co_names);
1853+
assert(numunbound >= 0);
18531854
struct co_unbound_counts unbound = {
1854-
.total = (int)PyTuple_GET_SIZE(co->co_names),
1855+
.total = numunbound,
18551856
// numglobal and numattrs can be set later
18561857
// with _PyCode_SetUnboundVarCounts().
1857-
.numunknown = (int)PyTuple_GET_SIZE(co->co_names),
1858+
.numunknown = numunbound,
18581859
};
18591860

18601861
// "Return" the result.

0 commit comments

Comments
 (0)