mirror of
https://github.com/astral-sh/ruff
synced 2026-01-22 14:00:51 -05:00
Update RustPython to fix Dict.keys type (#2086)
This PR upgrades RustPython to fix the type of `Dict.keys` to `Vec<Option<Expr>>` (see https://github.com/RustPython/RustPython/pull/4449 for why this change was needed) and unblock #1884.
This commit is contained in:
committed by
GitHub
parent
36fb8f7a63
commit
a7ce8621a9
@@ -678,17 +678,16 @@ impl<'a> Generator<'a> {
|
||||
ExprKind::Dict { keys, values } => {
|
||||
self.p("{");
|
||||
let mut first = true;
|
||||
let (packed, unpacked) = values.split_at(keys.len());
|
||||
for (k, v) in keys.iter().zip(packed) {
|
||||
for (k, v) in keys.iter().zip(values) {
|
||||
self.p_delim(&mut first, ", ");
|
||||
self.unparse_expr(k, precedence::TEST);
|
||||
self.p(": ");
|
||||
self.unparse_expr(v, precedence::TEST);
|
||||
}
|
||||
for d in unpacked {
|
||||
self.p_delim(&mut first, ", ");
|
||||
self.p("**");
|
||||
self.unparse_expr(d, precedence::EXPR);
|
||||
if let Some(k) = k {
|
||||
self.unparse_expr(k, precedence::TEST);
|
||||
self.p(": ");
|
||||
self.unparse_expr(v, precedence::TEST);
|
||||
} else {
|
||||
self.p("**");
|
||||
self.unparse_expr(v, precedence::EXPR);
|
||||
}
|
||||
}
|
||||
self.p("}");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user