Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 381a9bc

Browse files
committed
Issue #23571: Update test_capi
1 parent e0deff3 commit 381a9bc

1 file changed

Lines changed: 23 additions & 2 deletions

File tree

Lib/test/test_capi.py

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,15 @@ def test_return_null_without_error(self):
184184
_testcapi.return_null_without_error()
185185
""")
186186
rc, out, err = assert_python_failure('-c', code)
187-
self.assertIn(b'_Py_CheckFunctionResult', err)
187+
self.assertRegex(err.replace(b'\r', b''),
188+
br'Fatal Python error: '
189+
br'Function result is invalid\n'
190+
br'SystemError: <built-in function '
191+
br'return_null_without_error> returned NULL '
192+
br'without setting an error\n'
193+
br'\n'
194+
br'Current thread.*:\n'
195+
br' File .*", line 6 in <module>')
188196
else:
189197
with self.assertRaises(SystemError) as cm:
190198
_testcapi.return_null_without_error()
@@ -203,7 +211,20 @@ def test_return_result_with_error(self):
203211
_testcapi.return_result_with_error()
204212
""")
205213
rc, out, err = assert_python_failure('-c', code)
206-
self.assertIn(b'_Py_CheckFunctionResult', err)
214+
self.assertRegex(err.replace(b'\r', b''),
215+
br'Fatal Python error: '
216+
br'Function result is invalid\n'
217+
br'ValueError\n'
218+
br'\n'
219+
br'During handling of the above exception, '
220+
br'another exception occurred:\n'
221+
br'\n'
222+
br'SystemError: <built-in '
223+
br'function return_result_with_error> '
224+
br'returned a result with an error set\n'
225+
br'\n'
226+
br'Current thread.*:\n'
227+
br' File .*, line 6 in <module>')
207228
else:
208229
with self.assertRaises(SystemError) as cm:
209230
_testcapi.return_result_with_error()

0 commit comments

Comments
 (0)