10000 Address review · python/cpython@073b915 · GitHub
[go: up one dir, main page]

Skip to content

Commit 073b915

Browse files
committed
Address review
1 parent e0eec0f commit 073b915

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Modules/_testcapi/getargs.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,11 @@ 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+
Py_DECREF(num);
350+
goto error;
351+
}
352+
else if (value != ULONG_MAX) {
349353
Py_DECREF(num);
350354
PyErr_SetString(PyExc_AssertionError,
351355
"test_k_code: "
@@ -376,7 +380,12 @@ test_k_code(PyObject *self, PyObject *Py_UNUSED(ignored))
376380
}
377381

378382
value = PyLong_AsUnsignedLongMask(num);
379-
if (value != (unsigned long)-0x42) {
383+
if (value == (unsigned long)-1 && PyErr_Occurred()) {
384+
Py_DECREF(num);
385+
goto error;
386+
}
387+
else if (value != (unsigned long)-0x42) {
388+
Py_DECREF(num);
380389
PyErr_SetString(PyExc_AssertionError,
381390
"test_k_code: "
382391
"PyLong_AsUnsignedLongMask() returned wrong value for long -0xFFF..000042");

0 commit comments

Comments
 (0)
0