Skip to content
Merged
Show file tree
Hide file tree
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
Next Next commit
PythonFinallizationError
  • Loading branch information
youknowone committed Dec 30, 2025
commit 8dd6655ac9de9d199e23459e07a73f38bdcf8802
13 changes: 13 additions & 0 deletions crates/vm/src/exceptions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ pub struct ExceptionZoo {
pub runtime_error: &'static Py<PyType>,
pub not_implemented_error: &'static Py<PyType>,
pub recursion_error: &'static Py<PyType>,
pub python_finalization_error: &'static Py<PyType>,
pub syntax_error: &'static Py<PyType>,
pub incomplete_input_error: &'static Py<PyType>,
pub indentation_error: &'static Py<PyType>,
Expand Down Expand Up @@ -804,6 +805,7 @@ impl ExceptionZoo {
let runtime_error = PyRuntimeError::init_builtin_type();
let not_implemented_error = PyNotImplementedError::init_builtin_type();
let recursion_error = PyRecursionError::init_builtin_type();
let python_finalization_error = PyPythonFinalizationError::init_builtin_type();

let syntax_error = PySyntaxError::init_builtin_type();
let incomplete_input_error = PyIncompleteInputError::init_builtin_type();
Expand Down Expand Up @@ -879,6 +881,7 @@ impl ExceptionZoo {
runtime_error,
not_implemented_error,
recursion_error,
python_finalization_error,
syntax_error,
incomplete_input_error,
indentation_error,
Expand Down Expand Up @@ -992,6 +995,11 @@ impl ExceptionZoo {
extend_exception!(PyRuntimeError, ctx, excs.runtime_error);
extend_exception!(PyNotImplementedError, ctx, excs.not_implemented_error);
extend_exception!(PyRecursionError, ctx, excs.recursion_error);
extend_exception!(
PyPythonFinalizationError,
ctx,
excs.python_finalization_error
);

extend_exception!(PySyntaxError, ctx, excs.syntax_error, {
"msg" => ctx.new_static_getset(
Expand Down Expand Up @@ -2111,6 +2119,11 @@ pub(super) mod types {
#[repr(transparent)]
pub struct PyRecursionError(PyRuntimeError);

#[pyexception(name, base = PyRuntimeError, ctx = "python_finalization_error", impl)]
#[derive(Debug)]
#[repr(transparent)]
pub struct PyPythonFinalizationError(PyRuntimeError);

#[pyexception(name, base = PyException, ctx = "syntax_error")]
#[derive(Debug)]
#[repr(transparent)]
Expand Down
1 change: 1 addition & 0 deletions crates/vm/src/vm/vm_new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -600,5 +600,6 @@ impl VirtualMachine {
define_exception_fn!(fn new_zero_division_error, zero_division_error, ZeroDivisionError);
define_exception_fn!(fn new_overflow_error, overflow_error, OverflowError);
define_exception_fn!(fn new_runtime_error, runtime_error, RuntimeError);
define_exception_fn!(fn new_python_finalization_error, python_finalization_error, PythonFinalizationError);
define_exception_fn!(fn new_memory_error, memory_error, MemoryError);
}