antlr / antlr/antlr4

Python runtime test failure with 4.10 and later

Open
#4,041 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
19k
Forks
3.5k
PR merge metrics
No merged PRs in 30d

Description

After upgrading the antlr4 python runtime past 4.9.1 (tested 4.10.1 and 4.11.1) in nixpkgs, we've been seeing its test suite fail with

```pytb
Traceback (most recent call last):
File "/build/source/runtime/Python3/tests/ctest.py", line 10, in
from parser.cparser import CParser
File "/build/source/runtime/Python3/tests/parser/cparser.py", line 631, in
class CParser ( Parser ):
File "/build/source/runtime/Python3/tests/parser/cparser.py", line 635, in CParser
atn = ATNDeserializer().deserialize(serializedATN())
File "/nix/store/ch8i929c63av55h9nxkinifh61mazf1h-python3.10-antlr4-python3-runtime-4.11.1/lib/python3.10/site-packages/antlr4/atn/ATNDeserializer.py", line 28, in deserialize
self.checkVersion()
File "/nix/store/ch8i929c63av55h9nxkinifh61mazf1h-python3.10-antlr4-python3-runtime-4.11.1/lib/python3.10/site-packages/antlr4/atn/ATNDeserializer.py", line 50, in checkVersion
raise Exception("Could not deserialize ATN with version " + str(version) + " (expected " + str(SERIALIZED_VERSION) + ").")
Exception: Could not deserialize ATN with version (expected 4).
```

The version returned seems to be `\x03`, while the test suite expects it to be `4`.

While similar to #3997 and #3895 we are running the test suite, not our own code.

We're running `python ctest.py` from the `tests` directory.

Contributor guide

Open the contributing guide

Research direction

Start by running `python ctest.py` from `runtime/Python3/tests` and inspect the traceback through `tests/parser/cparser.py` into `antlr4/atn/ATNDeserializer.py`. Compare the serialized ATN version produced for the test parser with the runtime's expected version. Done means the Python runtime test suite passes for the affected 4.10 and later versions.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
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.