Skip to content

Commit 576f6cd

Browse files
committed
address review: restore errno + readability
1 parent 9702894 commit 576f6cd

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎Lib/test/test_complex.py‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import errno
12
import unittest
23
import sys
34
from test import support
@@ -795,8 +796,11 @@ def test_abs(self):
795796
def test_abs_errno_handling(self):
796797
_testcapi = import_helper.import_module('_testcapi')
797798
z = complex('nan')
798-
_testcapi.set_errno(34)
799-
self.assertTrue(isnan(abs(z)))
799+
_testcapi.set_errno(errno.ERANGE)
800+
try:
801+
self.assertTrue(isnan(abs(z)))
802+
finally:
803+
_testcapi.set_errno(0)
800804

801805
def test_repr_str(self):
802806
def test(v, expected, test_fn=self.assertEqual):

0 commit comments

Comments
 (0)