Skip to content

Commit 3cc5388

Browse files
committed
Adapt compile module context to the current parser APIs
Convert the single-mode multiple statements error into the generic parse error type, and iterate f-string parts through FStringPartRef. Assisted-by: Claude Code:claude-opus-5-5
1 parent 8968e1b commit 3cc5388

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎crates/vm/src/stdlib/_ast.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1820,7 +1820,7 @@ pub(crate) fn parse<E: From<CompileError>>(
18201820
&& let Some(error) =
18211821
rustpython_compiler::single_mode_multiple_statements_error(&source_file, &parsed)
18221822
{
1823-
return Err(error);
1823+
return Err(error.into());
18241824
}
18251825
let type_comment_source =
18261826
type_comments.then(|| TypeCommentSource::new(source, parsed.tokens()));

‎crates/vm/src/stdlib/_ast/string.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,8 @@ pub(super) fn emit_format_spec_warnings<E>(
395395
if let ast::Expr::FString(fstring) = expr {
396396
// Conversion checked all enclosing specs before converting their
397397
// expressions, including across concatenated f-string parts.
398-
for part in fstring.value.as_slice() {
399-
if let ast::FStringPart::FString(part) = part {
398+
for part in &fstring.value {
399+
if let ast::FStringPartRef::FString(part) = part {
400400
self.visit_format_specs(&part.elements, part.flags.prefix().is_raw());
401401
}
402402
}

0 commit comments

Comments
 (0)