There was an error while loading. Please reload this page.
1 parent 9702894 commit 576f6cdCopy full SHA for 576f6cd
1 file changed
Lib/test/test_complex.py
@@ -1,3 +1,4 @@
1
+import errno
2
import unittest
3
import sys
4
from test import support
@@ -795,8 +796,11 @@ def test_abs(self):
795
796
def test_abs_errno_handling(self):
797
_testcapi = import_helper.import_module('_testcapi')
798
z = complex('nan')
- _testcapi.set_errno(34)
799
- self.assertTrue(isnan(abs(z)))
+ _testcapi.set_errno(errno.ERANGE)
800
+ try:
801
+ self.assertTrue(isnan(abs(z)))
802
+ finally:
803
+ _testcapi.set_errno(0)
804
805
def test_repr_str(self):
806
def test(v, expected, test_fn=self.assertEqual):
0 commit comments