Skip to content

Commit 0bb06ab

Browse files
committed
apply review
1 parent 1922e84 commit 0bb06ab

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

Lib/test/test_patma.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff 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 ...:

compiler/codegen/src/compile.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3576,11 +3576,16 @@ impl Compiler {
35763576
let mut seen = std::collections::HashSet::new();
35773577
for key in keys {
35783578
let is_attribute = matches!(key, Expr::Attribute(_));
3579-
let key_repr = if let Expr::NumberLiteral(_)
3580-
| Expr::StringLiteral(_)
3581-
| Expr::BooleanLiteral(_) = key
3582-
{
3583-
format!("{:?}", key)
3579+
let is_literal = matches!(
3580+
key,
3581+
Expr::NumberLiteral(_)
3582+
| Expr::StringLiteral(_)
3583+
| Expr::BytesLiteral(_)
3584+
| Expr::BooleanLiteral(_)
3585+
| Expr::NoneLiteral(_)
3586+
);
3587+
let key_repr = if is_literal {
3588+
unparse_expr(key, &self.source_file).to_string()
35843589
} else if is_attribute {
35853590
String::new()
35863591
} else {

0 commit comments

Comments
 (0)