File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ pub(super) use decl::crc32;
55#[ pymodule( name = "binascii" ) ]
66mod decl {
77 use crate :: vm:: {
8- builtins:: { PyIntRef , PyTypeRef } ,
8+ builtins:: { PyBaseExceptionRef , PyIntRef , PyTypeRef } ,
99 function:: { ArgAsciiBuffer , ArgBytesLike , OptionalArg } ,
1010 PyResult , VirtualMachine ,
1111 } ;
@@ -93,6 +93,10 @@ mod decl {
9393 newline : bool ,
9494 }
9595
96+ fn new_binascii_error ( msg : String , vm : & VirtualMachine ) -> PyBaseExceptionRef {
97+ vm. new_exception_msg ( error_type ( vm) , msg)
98+ }
99+
96100 #[ pyfunction]
97101 fn a2b_base64 ( s : ArgAsciiBuffer , vm : & VirtualMachine ) -> PyResult < Vec < u8 > > {
98102 s. with_ref ( |b| {
@@ -109,7 +113,7 @@ mod decl {
109113 }
110114 base64:: decode ( b)
111115 } )
112- . map_err ( |err| vm . new_value_error ( format ! ( "error decoding base64: {}" , err) ) )
116+ . map_err ( |err| new_binascii_error ( format ! ( "error decoding base64: {}" , err) , vm ) )
113117 }
114118
115119 #[ pyfunction]
You can’t perform that action at this time.
0 commit comments