summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_capi.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-03-24 13:01:32 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2015-03-24 13:01:32 (GMT)
commit381a9bce9762fe2db4a7951f689df4d06ba53f79 (patch)
treeb1361967d07be91f6aaa55f7699471484ed176f2 /Lib/test/test_capi.py
parente0deff31d38f331107fd2ccd0b1f879ffc1fdb46 (diff)
downloadcpython-381a9bce9762fe2db4a7951f689df4d06ba53f79.zip
cpython-381a9bce9762fe2db4a7951f689df4d06ba53f79.tar.gz
cpython-381a9bce9762fe2db4a7951f689df4d06ba53f79.tar.bz2
Issue #23571: Update test_capi
Diffstat (limited to 'Lib/test/test_capi.py')
-rw-r--r--Lib/test/test_capi.py25
1 files changed, 23 insertions, 2 deletions
diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py
index fc48e38..8a92d6b 100644
--- a/Lib/test/test_capi.py
+++ b/Lib/test/test_capi.py
@@ -184,7 +184,15 @@ class CAPITest(unittest.TestCase):
_testcapi.return_null_without_error()
""")
rc, out, err = assert_python_failure('-c', code)
- self.assertIn(b'_Py_CheckFunctionResult', err)
+ self.assertRegex(err.replace(b'\r', b''),
+ br'Fatal Python error: '
+ br'Function result is invalid\n'
+ br'SystemError: <built-in function '
+ br'return_null_without_error> returned NULL '
+ br'without setting an error\n'
+ br'\n'
+ br'Current thread.*:\n'
+ br' File .*", line 6 in <module>')
else:
with self.assertRaises(SystemError) as cm:
_testcapi.return_null_without_error()
@@ -203,7 +211,20 @@ class CAPITest(unittest.TestCase):
_testcapi.return_result_with_error()
""")
rc, out, err = assert_python_failure('-c', code)
- self.assertIn(b'_Py_CheckFunctionResult', err)
+ self.assertRegex(err.replace(b'\r', b''),
+ br'Fatal Python error: '
+ br'Function result is invalid\n'
+ br'ValueError\n'
+ br'\n'
+ br'During handling of the above exception, '
+ br'another exception occurred:\n'
+ br'\n'
+ br'SystemError: <built-in '
+ br'function return_result_with_error> '
+ br'returned a result with an error set\n'
+ br'\n'
+ br'Current thread.*:\n'
+ br' File .*, line 6 in <module>')
else:
with self.assertRaises(SystemError) as cm:
_testcapi.return_result_with_error()