File tree Expand file tree Collapse file tree 3 files changed +12
-7
lines changed
Expand file tree Collapse file tree 3 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -3207,7 +3207,6 @@ def test_wildcard_makes_remaining_patterns_unreachable_5(self):
32073207 pass
32083208 """ )
32093209
3210- @unittest .expectedFailure # TODO: RUSTPYTHON
32113210 def test_mapping_pattern_duplicate_key (self ):
32123211 self .assert_syntax_error ("""
32133212 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 @@ -1332,10 +1332,11 @@ impl ExecutingFrame<'_> {
13321332 for key in keys {
13331333 match subject. get_item ( key. as_object ( ) , vm) {
13341334 Ok ( value) => values. push ( value) ,
1335- Err ( _ ) => {
1335+ Err ( e ) if e . fast_isinstance ( vm . ctx . exceptions . key_error ) => {
13361336 all_match = false ;
13371337 break ;
13381338 }
1339+ Err ( e) => return Err ( e) ,
13391340 }
13401341 }
13411342
You can’t perform that action at this time.
0 commit comments