-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[WIP] Use Ruff Parser #5423
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Use Ruff Parser #5423
Conversation
I am glad to see this, awesome. |
I was also wondering if this would be possible! Very cool :) |
There is a proc macro panic witch I did not understand. Could you try to solve it? @youknowone |
vm/src/vm/mod.rs
Outdated
// ext_modules!( | ||
// iter, | ||
// dir = "./Lib/python_builtins", | ||
// crate_name = "rustpython_compiler_core" | ||
// ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am sorry to be late.
The error caused when compiling Lib/python_builtins/__phello__/spam.py
Parsing step is ok, but compiling fails.
res.map_err(|e| e.into_codegen_error(source_path.to_owned()).into()) | ||
res.map_err(|e| e.into_codegen_error(source_code.path.to_owned()).into()) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't find the root cause yet, but adding this test will make using debugger or backtrace easy for the problem
#[test] | |
fn test_compile_phello() { | |
let code = r#" | |
initialized = True | |
def main(): | |
print("Hello world!") | |
if __name__ == '__main__': | |
main() | |
"#; | |
let compiled = compile(&code, Mode::Exec, "<>", CompileOpts::default()); | |
dbg!(compiled.expect("compile error")); | |
} |
running with
cargo test --manifest-path compiler/Cargo.toml
Hi, what is the status on PR? I can work on this if needed. |
@etaloof Could you please help? This PR need additonal works to make the upper commented new test passes |
Sure, should I make a new PR when I am done? I don't think Github allows me to add my commits here. |
compiler/codegen/src/compile.rs
Outdated
// If there are type params, we need to push a special symbol table just for them | ||
if !type_params.is_empty() { | ||
if !type_params.is_some() { | ||
self.push_symbol_table(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@qingshi163 @youknowone: This is the source of the bug.
As the comment says, // If there are type params, we need to push a special symbol table just for them
, but the change to !type_params.is_some()
(as in type_params.is_none()
) pushes if there are NO params, causing the panic!
in push_symbol_table
. On my machine changing to
if type_params.is_some() {
self.push_symbol_table();
}
allows test_compile_phello
to pass.
# Conflicts: # Cargo.lock # Cargo.toml # compiler/codegen/src/compile.rs # compiler/codegen/src/symboltable.rs # wasm/lib/src/convert.rs
oh no... I forget to reset upstream to @etaloof's, now it is pushed here |
Superseded by #5494 |
closes #5299