Skip to content

Commit 1e0db95

Browse files
authored
Apply suggestions from code review
1 parent 77be1bd commit 1e0db95

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Python/marshal.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,6 +1002,9 @@ r_PyLong(RFILE *p)
10021002
assert(layout->digit_size == 2 || layout->digit_size == 4);
10031003

10041004
Py_ssize_t size = 1 + (Py_ABS(n) - 1) / marshal_ratio;
1005+
1006+
assert(size >= 1);
1007+
10051008
int shorts_in_top_digit = 1 + (Py_ABS(n) - 1) % marshal_ratio;
10061009
void *digits;
10071010
PyLongWriter *writer = PyLongWriter_Create(n < 0, size, &digits);

0 commit comments

Comments
 (0)