Add builtin.PythonFinalizationError (#7966)

* Add PythonFinalizationError to builtins

* Patch failing tests (unrelated)

* Unmark passing test

* Update `exception_hierarchy.txt` to 3.14.5
This commit is contained in:
Shahar Naveh
2026-05-24 13:58:16 +03:00
committed by GitHub
parent 438925401f
commit 7011942e4e
4 changed files with 6 additions and 1 deletions

View File

@@ -40,6 +40,7 @@ BaseException
├── ReferenceError
├── RuntimeError
│ ├── NotImplementedError
│ ├── PythonFinalizationError
│ └── RecursionError
├── StopAsyncIteration
├── StopIteration

View File

@@ -2696,6 +2696,7 @@ class PtyTests(unittest.TestCase):
else:
yield
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: got 0 lines in pipe but expected 2, child output was: quux
def test_input_tty(self):
# Test input() functionality when wired to a tty
self.check_input_tty("prompt", b"quux")
@@ -2710,17 +2711,20 @@ class PtyTests(unittest.TestCase):
# Check stdin/stdout error handler is used when invoking PyOS_Readline()
self.check_input_tty("prompté", b"quux\xe9", "ascii")
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: got 0 lines in pipe but expected 2, child output was: quux
def test_input_tty_null_in_prompt(self):
self.check_input_tty("prompt\0", b"",
expected='ValueError: input: prompt string cannot contain '
'null characters')
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: got 0 lines in pipe but expected 2, child output was: quux
def test_input_tty_nonencodable_prompt(self):
self.check_input_tty("prompté", b"quux", "ascii", stdout_errors='strict',
expected="UnicodeEncodeError: 'ascii' codec can't encode "
"character '\\xe9' in position 6: ordinal not in "
"range(128)")
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: got 0 lines in pipe but expected 2, child output was: quux
def test_input_tty_nondecodable_input(self):
self.check_input_tty("prompt", b"quux\xe9", "ascii", stdin_errors='strict',
expected="UnicodeDecodeError: 'ascii' codec can't decode "

View File

@@ -775,7 +775,6 @@ class CompatPickleTests(unittest.TestCase):
module, name = mapping(module, name)
self.assertEqual((module, name), (module3, name3))
@unittest.expectedFailure # TODO: RUSTPYTHON
def test_exceptions(self):
self.assertEqual(mapping('exceptions', 'StandardError'),
('builtins', 'Exception'))

View File

@@ -1474,6 +1474,7 @@ pub fn init_module(vm: &VirtualMachine, module: &Py<PyModule>) {
"TimeoutError" => ctx.exceptions.timeout_error.to_owned(),
"ReferenceError" => ctx.exceptions.reference_error.to_owned(),
"RuntimeError" => ctx.exceptions.runtime_error.to_owned(),
"PythonFinalizationError" => ctx.exceptions.python_finalization_error.to_owned(),
"NotImplementedError" => ctx.exceptions.not_implemented_error.to_owned(),
"RecursionError" => ctx.exceptions.recursion_error.to_owned(),
"SyntaxError" => ctx.exceptions.syntax_error.to_owned(),