RustPython / RustPython/Parser

Hundread of files that are properly parsed(or not) in opposite to Python 3.11.2

Open
#66 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
117
Forks
38
Avg merge
4d 7h
Merged PRs (30d)
1

Description

d23611db65dca2a71eb58fdcdce9d637f8fef8c2

When parsing with this repo multiple files, I found that sometimes python cannot parse file but this library can and vice versa.

Command to check if python can parse file

python -m py_compile PY_FILE_TEST_427160.py

Code to check if parser can parse file

let rust_valid = parse(content.as_str(), Mode::Module,"").is_ok();

Only ~3% files from pack, can be parsed by python, but not rustpython parser

Pack 644 files - OUTPUT_FILES.zip

Example files and errors

return imprt

SyntaxError: 'return' outside function
\
 import _pl

Sorry: IndentationError: unexpected indent (79285088PY_FILE_TEST_5137609254.py, line 2)
# encoding: ut

SyntaxError: unknown encoding: ut
__p|ersion__ = '2.9.0'

SyntaxError: cannot assign to expression here. Maybe you meant '==' instead of '='?
from __future__ import un

SyntaxError: future feature un is not defined

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with OUTPUT_FILES.zip and compare python -m py_compile PY_FILE_TEST_427160.py against RustPython's parse(content.as_str(), Mode::Module, "").is_ok() for the listed examples. Reproduce and minimize the mismatches, then determine whether the parser behavior differs from Python 3.11.2; done means the reported discrepancies are fixed or clearly classified with regression coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
compilers, testing-qa
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.