Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[Bug]: NullPointerException with top-level `async with`

Open
#1,097 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
java, python
Domain
compilers

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

bug
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

Open the contributing guide

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.

More from oracle/graalpython

All issues in oracle/graalpython

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.