Skip to content

Commit b5b5936

Browse files
committed
Address review
1 parent e0eec0f commit b5b5936

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Modules/_testcapi/getargs.c

+8-2
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,10 @@ test_k_code(PyObject *self, PyObject *Py_UNUSED(ignored))
345345
}
346346

347347
unsigned long value = PyLong_AsUnsignedLongMask(num);
348-
if (value != ULONG_MAX) {
348+
if (value == (unsigned long)-1 && PyErr_Occurred()) {
349+
goto error;
350+
}
351+
else if (value != ULONG_MAX) {
349352
Py_DECREF(num);
350353
PyErr_SetString(PyExc_AssertionError,
351354
"test_k_code: "
@@ -376,7 +379,10 @@ test_k_code(PyObject *self, PyObject *Py_UNUSED(ignored))
376379
}
377380

378381
value = PyLong_AsUnsignedLongMask(num);
379-
if (value != (unsigned long)-0x42) {
382+
if (value == (unsigned long)-1 && PyErr_Occurred()) {
383+
goto error;
384+
}
385+
else if (value != (unsigned long)-0x42) {
380386
PyErr_SetString(PyExc_AssertionError,
381387
"test_k_code: "
382388
"PyLong_AsUnsignedLongMask() returned wrong value for long -0xFFF..000042");

0 commit comments

Comments
 (0)