GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [WIP] Use Ruff Parser by qingshi163 · Pull Request #5423 · RustPython/RustPython

Conversation

@qingshi163

@qingshi163 qingshi163 commented Oct 15, 2024 •
edited by youknowone
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

closes #5299

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

moreal, youknowone, and fu050409 reacted with thumbs up emoji
All reactions
  • 👍 3 reactions
qingshi163 added 5 commits September 10, 2024 19:09
@qingshi163
stage1
93b7d6b
@qingshi163
compiler pass build
e0a3f26
@qingshi163
introduce rustpython-compiler-source
38575bd
@qingshi163
stage2
dce0d94
@qingshi163
fixup
3162b9b
@youknowone

youknowone commented Oct 15, 2024

Copy link
Copy Markdown
Member

I am glad to see this, awesome.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@coolreader18

coolreader18 commented Oct 15, 2024

Copy link
Copy Markdown
Member

I was also wondering if this would be possible! Very cool :)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@qingshi163

qingshi163 commented Oct 19, 2024

Copy link
Copy Markdown
Contributor Author

There is a proc macro panic witch I did not understand. Could you try to solve it? @youknowone

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@qingshi163
pass compile
1f7024a
youknowone
youknowone reviewed Oct 30, 2024
View reviewed changes
Comment thread vm/src/vm/mod.rs Outdated
Comment on lines +907 to +911
// ext_modules!(
// iter,
// dir = "./Lib/python_builtins",
// crate_name = "rustpython_compiler_core"
// );

@youknowone youknowone Oct 30, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
youknowone
youknowone reviewed Oct 30, 2024
View reviewed changes
Comment thread compiler/src/lib.rs
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())
}

@youknowone youknowone Oct 30, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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

Suggested change
#[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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@etaloof

etaloof commented Nov 12, 2024

Copy link
Copy Markdown
Contributor

Hi, what is the status on PR? I can work on this if needed.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@youknowone

youknowone commented Nov 12, 2024

Copy link
Copy Markdown
Member

@etaloof Could you please help? This PR need additonal works to make the upper commented new test passes

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@etaloof

etaloof commented Nov 12, 2024

Copy link
Copy Markdown
Contributor

Sure, should I make a new PR when I am done? I don't think Github allows me to add my commits here.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

dcechano
dcechano reviewed Nov 30, 2024
View reviewed changes
Comment thread compiler/codegen/src/compile.rs
Comment on lines 1304 to 1307
// 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();
}

@dcechano dcechano Nov 30, 2024

Copy link
Copy Markdown

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

qingshi163 and youknowone reacted with thumbs up emoji
All reactions
  • 👍 2 reactions
etaloof added 15 commits December 2, 2024 20:00
@etaloof
Fix hello world compiler test
e189ecf
@etaloof
Fix code generation for if-elif-else statement
0f100e9
@etaloof
Fix code generation for lambda expression
b42f88f
@etaloof
Fix code generation for integers
7c53857
@etaloof
Fix code generation for fstrings
424e05a
@etaloof
Fix code generation for if statement
2691cbe
@etaloof
Fix code generation for if statement
a98a623
@etaloof
Fix code generation for if statement
168aa01
@etaloof
Fix code generation for fstring
c25d958
@etaloof
Fix code generation for class definition
4e29dd4
@etaloof
Replace feature flags
89afad2
@etaloof
Initialize frozen core modules
e760ac7
@etaloof
Allow __future__ import after module doc comment
2987cbe
@etaloof
Disable ast module
c10df16
@etaloof
Commit remaining fixes for compile errors in examples
bcfbf88
@etaloof etaloof mentioned this pull request Dec 2, 2024
Replace Python parser with ruff parser #5453
Closed
etaloof and others added 24 commits December 6, 2024 16:01
@etaloof
Fix some warnings
def0e42
@etaloof
Update ast stdlib module
4bef13b
@etaloof
Update ast stdlib module
1fd48c7
@etaloof
Update ast stdlib module
ca2b302
@etaloof
Update ast stdlib module
e9bc377
@etaloof
Update ast stdlib module
c6ece03
@etaloof
Split ast stdlib module into files
5c22c39
@etaloof
Fix codegen for positional arguments with defaults
6b49cfb
@etaloof
Update ast stdlib module
4cdd4ae
@etaloof
Update ast stdlib module
f03d43f
@etaloof
Extract string and constant handling from expression.rs
60dc970
@etaloof
Always add required fields to AST nodes
5bd4d5b
@etaloof
Compile doc strings correctly again
85edb25
@etaloof
Enable "ast" Cargo feature by default
f4154a0
@etaloof
Refactor compilation of big integer literal
1bff3dc
@etaloof
Update ast stdlib module
a669803
@etaloof
Update ast stdlib module
1bd4078
@etaloof
Update ast stdlib module
a054ca6
@etaloof
Reset barebones example
1476b49
@etaloof
Merge remote-tracking branch 'refs/remotes/origin/main' into ruff-parser
1a3c5bb
# Conflicts:
#	Cargo.lock
#	Cargo.toml
#	compiler/codegen/src/compile.rs
#	compiler/codegen/src/symboltable.rs
#	wasm/lib/src/convert.rs
@etaloof
Fix some left-over warnings
595622b
@etaloof
Undo accidential change
c00d58f
@etaloof
Adapt shell to ruff parser
d08716f
@youknowone
Pin parser to v0.4.10
c8acbf8
@youknowone

youknowone commented Jan 27, 2025

Copy link
Copy Markdown
Member

oh no... I forget to reset upstream to @etaloof's, now it is pushed here

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@youknowone
fix clippy
c04f702
@coolreader18

coolreader18 commented Mar 20, 2025

Copy link
Copy Markdown
Member

Superseded by #5494

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@coolreader18 coolreader18 closed this Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@youknowone youknowone youknowone left review comments
+1 more reviewer
@dcechano dcechano dcechano left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Replace parser

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@qingshi163 @youknowone @coolreader18 @etaloof @dcechano
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.