@@ -24,8 +24,8 @@ mod builtins {
2424 format:: call_object_format,
2525 function:: Either ,
2626 function:: {
27- ArgBytesLike , ArgCallable , ArgIntoBool , ArgIterable , ArgMapping , FuncArgs , KwArgs ,
28- OptionalArg , OptionalOption , PosArgs , PyArithmeticValue ,
27+ ArgBytesLike , ArgCallable , ArgIntoBool , ArgIterable , ArgMapping , ArgStrOrBytesLike ,
28+ FuncArgs , KwArgs , OptionalArg , OptionalOption , PosArgs , PyArithmeticValue ,
2929 } ,
3030 protocol:: { PyIter , PyIterReturn } ,
3131 py_io,
@@ -248,20 +248,14 @@ mod builtins {
248248 #[ cfg( feature = "rustpython-compiler" ) ]
249249 #[ pyfunction]
250250 fn eval (
251- source : Either <
252- Either < PyStrRef , crate :: builtins:: PyBytesRef > ,
253- PyRef < crate :: builtins:: PyCode > ,
254- > ,
251+ source : Either < ArgStrOrBytesLike , PyRef < crate :: builtins:: PyCode > > ,
255252 scope : ScopeArgs ,
256253 vm : & VirtualMachine ,
257254 ) -> PyResult {
258255 // source as string
259256 let code = match source {
260257 Either :: A ( either) => {
261- let source: & [ u8 ] = match either {
262- Either :: A ( ref a) => a. as_str ( ) . as_bytes ( ) ,
263- Either :: B ( ref b) => b. as_bytes ( ) ,
264- } ;
258+ let source: & [ u8 ] = & either. borrow_bytes ( ) ;
265259 for x in source {
266260 if * x == 0 {
267261 return Err ( vm. new_value_error (
0 commit comments