Skip to content

Commit 7011942

Browse files
authored
Add builtin.PythonFinalizationError (RustPython#7966)
* Add PythonFinalizationError to builtins * Patch failing tests (unrelated) * Unmark passing test * Update `exception_hierarchy.txt` to 3.14.5
1 parent 4389254 commit 7011942

4 files changed

Lines changed: 6 additions & 1 deletion

File tree

Lib/test/exception_hierarchy.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ BaseException
4040
├── ReferenceError
4141
├── RuntimeError
4242
│ ├── NotImplementedError
43+
│ ├── PythonFinalizationError
4344
│ └── RecursionError
4445
├── StopAsyncIteration
4546
├── StopIteration

Lib/test/test_builtin.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2696,6 +2696,7 @@ def detach_readline(self):
26962696
else:
26972697
yield
26982698

2699+
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: got 0 lines in pipe but expected 2, child output was: quux
26992700
def test_input_tty(self):
27002701
# Test input() functionality when wired to a tty
27012702
self.check_input_tty("prompt", b"quux")
@@ -2710,17 +2711,20 @@ def test_input_tty_non_ascii_unicode_errors(self):
27102711
# Check stdin/stdout error handler is used when invoking PyOS_Readline()
27112712
self.check_input_tty("prompté", b"quux\xe9", "ascii")
27122713

2714+
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: got 0 lines in pipe but expected 2, child output was: quux
27132715
def test_input_tty_null_in_prompt(self):
27142716
self.check_input_tty("prompt\0", b"",
27152717
expected='ValueError: input: prompt string cannot contain '
27162718
'null characters')
27172719

2720+
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: got 0 lines in pipe but expected 2, child output was: quux
27182721
def test_input_tty_nonencodable_prompt(self):
27192722
self.check_input_tty("prompté", b"quux", "ascii", stdout_errors='strict',
27202723
expected="UnicodeEncodeError: 'ascii' codec can't encode "
27212724
"character '\\xe9' in position 6: ordinal not in "
27222725
"range(128)")
27232726

2727+
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: got 0 lines in pipe but expected 2, child output was: quux
27242728
def test_input_tty_nondecodable_input(self):
27252729
self.check_input_tty("prompt", b"quux\xe9", "ascii", stdin_errors='strict',
27262730
expected="UnicodeDecodeError: 'ascii' codec can't decode "

Lib/test/test_pickle.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,6 @@ def test_reverse_name_mapping(self):
775775
module, name = mapping(module, name)
776776
self.assertEqual((module, name), (module3, name3))
777777

778-
@unittest.expectedFailure # TODO: RUSTPYTHON
779778
def test_exceptions(self):
780779
self.assertEqual(mapping('exceptions', 'StandardError'),
781780
('builtins', 'Exception'))

crates/vm/src/stdlib/builtins.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1474,6 +1474,7 @@ pub fn init_module(vm: &VirtualMachine, module: &Py<PyModule>) {
14741474
"TimeoutError" => ctx.exceptions.timeout_error.to_owned(),
14751475
"ReferenceError" => ctx.exceptions.reference_error.to_owned(),
14761476
"RuntimeError" => ctx.exceptions.runtime_error.to_owned(),
1477+
"PythonFinalizationError" => ctx.exceptions.python_finalization_error.to_owned(),
14771478
"NotImplementedError" => ctx.exceptions.not_implemented_error.to_owned(),
14781479
"RecursionError" => ctx.exceptions.recursion_error.to_owned(),
14791480
"SyntaxError" => ctx.exceptions.syntax_error.to_owned(),

0 commit comments

Comments
 (0)