[Bug]: NullPointerException with top-level `async with`
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 68/100
Research direction
Start by reproducing the top-level async with _: snippet on Linux with GraalPy 3.13.14, then trace the failure through ParserCallbacksImpl.raiseSyntaxError and RootNodeCompiler's statement visitor. Done means the snippet no longer crashes with a NullPointerException and produces the expected non-crashing behavior.
Written by the indexing model from the issue text.
Description
Describe the bug
GraalPy crashes when running this fuzzed code:
async with _:
pass
Operating system
Linux
CPU architecture
x86_64
GraalPy version
GraalPy 3.13.14 (Oracle GraalVM Native 25.3.4.1)
JDK version
No response
Context configuration
No response
Steps to reproduce
Snippet listed above
Expected behavior
No crash
Stack trace
java.lang.NullPointerException: Stack trace is imprecise, the top frames are missing and/or have wrong line numbers. To get precise stack traces, build the image with option -H:-ReduceImplicitExceptionStackTraceInformation
at org.graalvm.py/com.oracle.graal.python.compiler.ParserCallbacksImpl.raiseSyntaxError(ParserCallbacksImpl.java:126)
at org.graalvm.py/com.oracle.graal.python.compiler.ParserCallbacksImpl.raiseSyntaxError(ParserCallbacksImpl.java:122)
at org.graalvm.py/com.oracle.graal.python.compiler.ParserCallbacksImpl.onError(ParserCallbacksImpl.java:118)
at org.graalvm.py/com.oracle.graal.python.compiler.bytecode_dsl.RootNodeCompiler$StatementCompiler.visit(RootNodeCompiler.java:3953)
at org.graalvm.py/com.oracle.graal.python.compiler.bytecode_dsl.RootNodeCompiler$StatementCompiler.visit(RootNodeCompiler.java:2001)
at org.graalvm.py/com.oracle.graal.python.pegparser.sst.StmtTy$AsyncWith.accept(StmtTy.java:381)
at org.graalvm.py/com.oracle.graal.python.compiler.bytecode_dsl.RootNodeCompiler.visitModuleBody(RootNodeCompiler.java:1090)
at org.graalvm.py/com.oracle.graal.python.compiler.bytecode_dsl.RootNodeCompiler.lambda$visit$0(RootNodeCompiler.java:1007)
at org.graalvm.py/com.oracle.graal.python.nodes.bytecode_dsl.PBytecodeDSLRootNodeGen$Bytecode.create(PBytecodeDSLRootNodeGen.java:4988)
at org.graalvm.py/com.oracle.graal.python.nodes.bytecode_dsl.PBytecodeDSLRootNodeGen.create(PBytecodeDSLRootNodeGen.java:3790)
at org.graalvm.py/com.oracle.graal.python.compiler.bytecode_dsl.RootNodeCompiler.compileRootNode(RootNodeCompiler.java:530)
at org.graalvm.py/com.oracle.graal.python.compiler.bytecode_dsl.RootNodeCompiler.visit(RootNodeCompiler.java:1005)
at org.graalvm.py/com.oracle.graal.python.compiler.bytecode_dsl.RootNodeCompiler.visit(RootNodeCompiler.java:186)
at org.graalvm.py/com.oracle.graal.python.pegparser.sst.ModTy$Module.accept(ModTy.java:68)
at org.graalvm.py/com.oracle.graal.python.compiler.bytecode_dsl.RootNodeCompiler.compile(RootNodeCompiler.java:755)
at org.graalvm.py/com.oracle.graal.python.compiler.bytecode_dsl.BytecodeDSLCompiler.compile(BytecodeDSLCompiler.java:86)
at org.graalvm.py/com.oracle.graal.python.PythonLanguage.compileForBytecodeDSLInterpreter(PythonLanguage.java:661)
at org.graalvm.py/com.oracle.graal.python.PythonLanguage.compileModule(PythonLanguage.java:633)
at org.graalvm.py/com.oracle.graal.python.PythonLanguage.parse(PythonLanguage.java:601)
at org.graalvm.py/com.oracle.graal.python.PythonLanguage.parse(PythonLanguage.java:588)
at org.graalvm.py/com.oracle.graal.python.PythonLanguage.parse(PythonLanguage.java:574)
[...snip...]
Additional context
No response
- Dominant language
- Python
- Stars
- 1.6k
- Forks
- 155
- Avg merge
- 8h 20m
- Merged PRs (30d)
- 43
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from oracle/graalpython
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
oracle/graalpython#1105 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
oracle/graalpython#1102 ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 74/100
oracle/graalpython#1133 ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 68/100
oracle/graalpython#1112 ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 68/100
oracle/graalpython#1111 ·
All issues in oracle/graalpython
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
anthropics/skills#1811 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
speaches-ai/speaches#678 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
datalayer/mcp-compose#42 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
conda-forge/spacy-feedstock#177 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
UKGovernmentBEIS/inspect_evals#2523 ·