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:
Harutaka Kawamura
2023-01-23 03:24:00 +09:00
committed by GitHub
parent 36fb8f7a63
commit a7ce8621a9
18 changed files with 156 additions and 97 deletions

View File

@@ -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("}");
}