Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Address review
  • Loading branch information
Eclips4 committed May 16, 2024
commit 86dda917b3ab8ce28d67f219f9c6c3bdfe999f95
7 changes: 4 additions & 3 deletions Lib/test/test_capi/test_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,18 @@ def test_warn_during_finalization(self):
import _testcapi

class Foo:
def __del__(self):
def foo(self):
_testcapi.function_set_warning()
def __del__(self):
self.foo()

ref = Foo()
''')
proc = assert_python_ok("-c", code)
warnings = proc.err.splitlines()
# Due to the finalization of the interpreter, the source will be ommited
# because the ``warnings`` module cannot be imported at this time
self.assertEqual(len(warnings), 1)
self.assertEqual(warnings[0], b'<sys>:0: RuntimeWarning: Testing PyErr_WarnEx')
self.assertEqual(warnings, [b'<string>:7: RuntimeWarning: Testing PyErr_WarnEx'])


class Test_FatalError(unittest.TestCase):
Expand Down