File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -479,8 +479,6 @@ def __trunc__(self):
479
479
self .assertEqual (n , 1 )
480
480
self .assertIs (type (n ), IntSubclass )
481
481
482
- # TODO: RUSTPYTHON
483
- @unittest .expectedFailure
484
482
def test_error_message (self ):
485
483
def check (s , base = None ):
486
484
with self .assertRaises (ValueError ,
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ use super::objbyteinner::PyByteInner;
11
11
use super :: objbytes:: PyBytes ;
12
12
use super :: objfloat;
13
13
use super :: objmemory:: PyMemoryView ;
14
- use super :: objstr:: { PyString , PyStringRef } ;
14
+ use super :: objstr:: { PyString , PyStringRef , PyStringRepr } ;
15
15
use super :: objtype:: { self , PyClassRef } ;
16
16
use crate :: exceptions:: PyBaseExceptionRef ;
17
17
use crate :: format:: FormatSpec ;
@@ -864,8 +864,12 @@ fn detect_base(literal: &str) -> Option<u32> {
864
864
}
865
865
866
866
fn invalid_literal ( vm : & VirtualMachine , literal : & str , base : & BigInt ) -> PyBaseExceptionRef {
867
+ let literal = match PyStringRepr :: try_from_str ( literal, vm) {
868
+ Ok ( r) => r,
869
+ Err ( e) => return e,
870
+ } ;
867
871
vm. new_value_error ( format ! (
868
- "invalid literal for int() with base {}: '{}' " ,
872
+ "invalid literal for int() with base {}: {} " ,
869
873
base, literal
870
874
) )
871
875
}
You can’t perform that action at this time.
0 commit comments