[Bug]: NullPointerException with `__debug__` type alias
Open
Nobody has claimed this yet.
bug
- Dominant language
- Python
- Stars
- 1.6k
- Forks
- 155
- Avg merge
- 9h 42m
- Merged PRs (30d)
- 36
Description
Describe the bug
GraalPy crashes when running this fuzzed code:
type __debug__ = int
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.SSTUtils.checkForbiddenName(SSTUtils.java:90)
at org.graalvm.py/com.oracle.graal.python.compiler.bytecode_dsl.RootNodeCompiler.checkForbiddenName(RootNodeCompiler.java:667)
at org.graalvm.py/com.oracle.graal.python.compiler.bytecode_dsl.RootNodeCompiler.checkForbiddenName(RootNodeCompiler.java:658)
at org.graalvm.py/com.oracle.graal.python.compiler.bytecode_dsl.RootNodeCompiler.emitNameOperation(RootNodeCompiler.java:1817)
at org.graalvm.py/com.oracle.graal.python.compiler.bytecode_dsl.RootNodeCompiler.beginStoreLocal(RootNodeCompiler.java:1859)
at org.graalvm.py/com.oracle.graal.python.compiler.bytecode_dsl.RootNodeCompiler$StatementCompiler.visit(RootNodeCompiler.java:6976)
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$TypeAlias.accept(StmtTy.java:216)
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
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.
Research direction
Start with the failing snippet type __debug__ = int and trace the reported path through SSTUtils.checkForbiddenName and RootNodeCompiler. Reproduce it on GraalPy 3.13.14, then add a regression test using the snippet. Done means the input no longer crashes with a NullPointerException and produces the expected language-level result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, python
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100