forked from Rust-related/RustPython
remove exception_slots
This commit is contained in:
@@ -512,15 +512,13 @@ pub struct ExceptionZoo {
|
||||
pub resource_warning: PyTypeRef,
|
||||
}
|
||||
|
||||
pub fn exception_slots() -> crate::slots::PyTypeSlots {
|
||||
let mut slots = PyBaseException::make_slots();
|
||||
// make_slots produces it with a tp_name of BaseException, which is usually wrong
|
||||
slots.name.get_mut().take();
|
||||
slots
|
||||
}
|
||||
|
||||
pub fn create_exception_type(name: &str, base: &PyTypeRef) -> PyTypeRef {
|
||||
create_type_with_slots(name, PyType::static_type(), base, exception_slots())
|
||||
create_type_with_slots(
|
||||
name,
|
||||
PyType::static_type(),
|
||||
base,
|
||||
PyBaseException::make_slots(),
|
||||
)
|
||||
}
|
||||
|
||||
macro_rules! extend_exception {
|
||||
|
||||
@@ -6,7 +6,9 @@ use crate::common::{
|
||||
use crate::{
|
||||
builtins::{PyStrRef, PyType, PyTypeRef, PyWeak},
|
||||
byteslike::{ArgBytesLike, ArgMemoryBuffer, ArgStrOrBytesLike},
|
||||
exceptions::{self, create_exception_type, IntoPyException, PyBaseExceptionRef},
|
||||
exceptions::{
|
||||
self, create_exception_type, IntoPyException, PyBaseException, PyBaseExceptionRef,
|
||||
},
|
||||
function::{ArgCallable, OptionalArg},
|
||||
slots::SlotConstructor,
|
||||
stdlib::os::PyPathLike,
|
||||
@@ -1119,7 +1121,7 @@ pub fn make_module(vm: &VirtualMachine) -> PyObjectRef {
|
||||
ssl_error.clone(),
|
||||
vec![ssl_error.clone(), ctx.exceptions.value_error.clone()],
|
||||
Default::default(),
|
||||
crate::exceptions::exception_slots(),
|
||||
PyBaseException::make_slots(),
|
||||
)
|
||||
.unwrap();
|
||||
let ssl_zero_return_error = create_exception_type("SSLZeroReturnError", &ssl_error);
|
||||
|
||||
Reference in New Issue
Block a user