Skip to content

Commit 0fc0c21

Browse files
Apply suggestions from code review
Co-authored-by: Sergey B Kirpichev <[email protected]>
1 parent b15c219 commit 0fc0c21

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Lib/test/test_capi/test_long.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,7 @@ def check_long_asintandoverflow(self, func, min_val, max_val):
211211

212212
self.assertEqual(func(min_val - 1), (-1, -1))
213213
self.assertEqual(func(max_val + 1), (-1, +1))
214-
with self.assertRaises(SystemError):
215-
func(None)
214+
self.assertRaises(SystemError, func, None)
216215

217216
# CRASHES func(1.0)
218217

Modules/_testlimitedcapi/long.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,7 @@ pylong_aslonglongandoverflow(PyObject *module, PyObject *arg)
672672
int overflow = UNINITIALIZED_INT;
673673
long long value = PyLong_AsLongLongAndOverflow(arg, &overflow);
674674
if (value == -1 && PyErr_Occurred()) {
675+
// overflow can be 0 if a seperate exception occurred
675676
assert(overflow == -1 || overflow == 0);
676677
return NULL;
677678
}

0 commit comments

Comments
 (0)