Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
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
2 changes: 0 additions & 2 deletions Lib/test/test_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1923,8 +1923,6 @@ def test_non_str_argument(self):
exc = ImportError(arg)
self.assertEqual(str(arg), str(exc))

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_copy_pickle(self):
for kwargs in (dict(),
dict(name='somename'),
Expand Down
15 changes: 14 additions & 1 deletion vm/src/exceptions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ use self::types::{PyBaseException, PyBaseExceptionRef};
use crate::common::lock::PyRwLock;
use crate::{
builtins::{
traceback::PyTracebackRef, PyNone, PyStr, PyStrRef, PyTuple, PyTupleRef, PyType, PyTypeRef,
traceback::PyTracebackRef, PyDictRef, PyNone, PyStr, PyStrRef, PyTuple, PyTupleRef, PyType,
PyTypeRef,
},
class::{PyClassImpl, StaticType},
convert::{ToPyException, ToPyObject},
Expand Down Expand Up @@ -519,6 +520,18 @@ impl PyBaseException {
let cls = zelf.class();
format!("{}({})", cls.name(), repr_args.iter().format(", "))
}

#[pymethod(magic)]
fn reduce(
zelf: PyRef<Self>,
_vm: &VirtualMachine,
) -> (PyTypeRef, PyTupleRef, Option<PyDictRef>) {
(
zelf.class().clone(),
zelf.args(),
zelf.as_object().dict(),
)
Comment thread
fanninpm marked this conversation as resolved.
Outdated
}
}

impl ExceptionZoo {
Expand Down