diff --git a/vm/src/exceptions.rs b/vm/src/exceptions.rs index 2971c6f292..329477332e 100644 --- a/vm/src/exceptions.rs +++ b/vm/src/exceptions.rs @@ -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 { diff --git a/vm/src/stdlib/ssl.rs b/vm/src/stdlib/ssl.rs index 2220713b86..7db6121f6d 100644 --- a/vm/src/stdlib/ssl.rs +++ b/vm/src/stdlib/ssl.rs @@ -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);