gh-108082: Remove _PyErr_WriteUnraisableMsg() (GH-111643)

Replace the remaining calls with PyErr_FormatUnraisable().
This commit is contained in:
Serhiy Storchaka 2023-11-03 09:45:53 +02:00 committed by GitHub
parent 0d3df272fb
commit 26c0e5e03a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 85 additions and 147 deletions

View file

@ -19,7 +19,9 @@ class GeneralTest(unittest.TestCase):
atexit.register(func, *args)
atexit._run_exitfuncs()
self.assertEqual(cm.unraisable.object, func)
self.assertIsNone(cm.unraisable.object)
self.assertEqual(cm.unraisable.err_msg,
f'Exception ignored in atexit callback {func!r}')
self.assertEqual(cm.unraisable.exc_type, exc_type)
self.assertEqual(type(cm.unraisable.exc_value), exc_type)
@ -125,7 +127,9 @@ class GeneralTest(unittest.TestCase):
try:
with support.catch_unraisable_exception() as cm:
atexit._run_exitfuncs()
self.assertEqual(cm.unraisable.object, func)
self.assertIsNone(cm.unraisable.object)
self.assertEqual(cm.unraisable.err_msg,
f'Exception ignored in atexit callback {func!r}')
self.assertEqual(cm.unraisable.exc_type, ZeroDivisionError)
self.assertEqual(type(cm.unraisable.exc_value), ZeroDivisionError)
finally: