RustPython / RustPython/Parser

Parser incompatibility with "def woohoo(a, *, b): pass"

Open
#43 0 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

>>> ast.dump(ast.parse("def woohoo(a, *, b): pass"))
"Module(body=[FunctionDef(name='woohoo', args=arguments(posonlyargs=[], args=[arg(arg='a')], kwonlyargs=[arg(arg='b')], kw_defaults=[None], defaults=[]), body=[Pass()], decorator_list=[])], type_ignores=[])"
>>> ast.dump(rustpython_parse("def woohoo(a, *, b): pass"))
"Module(body=[FunctionDef(name='woohoo', args=arguments(posonlyargs=[], args=[arg(arg='a')], kwonlyargs=[arg(arg='b')], kw_defaults=[], defaults=[]), body=[Pass()], decorator_list=[])], type_ignores=[])"

kw_defaults=[None] vs kw_defaults=[]

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

Reproduce the discrepancy by comparing Python's ast.parse with rustpython_parse for "def woohoo(a, *, b): pass". Trace the parser entry point behind rustpython_parse and verify that the resulting FunctionDef arguments include kw_defaults=[None] for a required keyword-only argument, matching Python's AST output.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.