File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3206,7 +3206,6 @@ def test_wildcard_makes_remaining_patterns_unreachable_5(self):
32063206 pass
32073207 """ )
32083208
3209- @unittest .expectedFailure # TODO: RUSTPYTHON
32103209 def test_mapping_pattern_duplicate_key (self ):
32113210 self .assert_syntax_error ("""
32123211 match ...:
Original file line number Diff line number Diff line change @@ -3583,11 +3583,16 @@ impl Compiler {
35833583 let mut seen = std:: collections:: HashSet :: new ( ) ;
35843584 for key in keys {
35853585 let is_attribute = matches ! ( key, Expr :: Attribute ( _) ) ;
3586- let key_repr = if let Expr :: NumberLiteral ( _)
3587- | Expr :: StringLiteral ( _)
3588- | Expr :: BooleanLiteral ( _) = key
3589- {
3590- format ! ( "{:?}" , key)
3586+ let is_literal = matches ! (
3587+ key,
3588+ Expr :: NumberLiteral ( _)
3589+ | Expr :: StringLiteral ( _)
3590+ | Expr :: BytesLiteral ( _)
3591+ | Expr :: BooleanLiteral ( _)
3592+ | Expr :: NoneLiteral ( _)
3593+ ) ;
3594+ let key_repr = if is_literal {
3595+ unparse_expr ( key, & self . source_file ) . to_string ( )
35913596 } else if is_attribute {
35923597 String :: new ( )
35933598 } else {
Original file line number Diff line number Diff line change @@ -1341,10 +1341,11 @@ impl ExecutingFrame<'_> {
13411341 for key in keys {
13421342 match subject. get_item ( key. as_object ( ) , vm) {
13431343 Ok ( value) => values. push ( value) ,
1344- Err ( _ ) => {
1344+ Err ( e ) if e . fast_isinstance ( vm . ctx . exceptions . key_error ) => {
13451345 all_match = false ;
13461346 break ;
13471347 }
1348+ Err ( e) => return Err ( e) ,
13481349 }
13491350 }
13501351
You can’t perform that action at this time.
0 commit comments