Skip to content

Commit af6a910

Browse files
committed
Fix C API tests.
1 parent ee106a2 commit af6a910

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Lib/test/test_capi/test_misc.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ class InstanceMethod:
7575
id = _testcapi.instancemethod(id)
7676
testfunction = _testcapi.instancemethod(testfunction)
7777

78+
CURRENT_THREAD_REGEX = r'Current thread.*:\n' if not support.Py_GIL_DISABLED else r'Stack .*:\n'
79+
7880
class CAPITest(unittest.TestCase):
7981

8082
def test_instancemethod(self):
@@ -234,8 +236,8 @@ def test_return_null_without_error(self):
234236
r'Python runtime state: initialized\n'
235237
r'SystemError: <built-in function return_null_without_error> '
236238
r'returned NULL without setting an exception\n'
237-
r'\n'
238-
r'Current thread.*:\n'
239+
r'\n' +
240+
CURRENT_THREAD_REGEX +
239241
r' File .*", line 6 in <module>\n')
240242
else:
241243
with self.assertRaises(SystemError) as cm:
@@ -268,8 +270,8 @@ def test_return_result_with_error(self):
268270
r'SystemError: <built-in '
269271
r'function return_result_with_error> '
270272
r'returned a result with an exception set\n'
271-
r'\n'
272-
r'Current thread.*:\n'
273+
r'\n' +
274+
CURRENT_THREAD_REGEX +
273275
r' File .*, line 6 in <module>\n')
274276
else:
275277
with self.assertRaises(SystemError) as cm:
@@ -298,8 +300,8 @@ def test_getitem_with_error(self):
298300
r'with an exception set\n'
299301
r'Python runtime state: initialized\n'
300302
r'ValueError: bug\n'
301-
r'\n'
302-
r'Current thread .* \(most recent call first\):\n'
303+
r'\n' +
304+
CURRENT_THREAD_REGEX +
303305
r' File .*, line 6 in <module>\n'
304306
r'\n'
305307
r'Extension modules: _testcapi \(total: 1\)\n')

0 commit comments

Comments
 (0)