Skip to content

Commit 0d2f27e

Browse files
committed
More ergonomic int cast code
1 parent ab26ad9 commit 0d2f27e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Modules/_uuidmodule.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -837,10 +837,8 @@ extract_field(
837837
goto fail;
838838
}
839839

840-
int overflow;
841-
uint64_t value = PyLong_AsLongLongAndOverflow(field, &overflow);
842-
if (overflow || (value == (uint64_t)-1 && PyErr_Occurred())) {
843-
PyErr_SetString(PyExc_ValueError, error_msg);
840+
uint64_t value;
841+
if (PyLong_AsUInt64(field, &value) < 0) {
844842
goto fail;
845843
}
846844

0 commit comments

Comments
 (0)