uesleilima opened a new pull request, #2372: URL: https://github.com/apache/age/pull/2372
## Summary Fix two related issues in the Python driver's ANTLR4 parsing pipeline: ### 1. ANTLR4 agtype parser crashes on vertices with complex properties (#2367) The `ResultVisitor` in `builder.py` crashes with `AttributeError: 'NoneType' object has no attribute 'stop'` when deserializing certain vertex records whose properties contain large arrays, long text fields with special characters, or deeply nested structures. **Root cause:** Several visitor methods access child nodes (`.symbol`, `.getText()`, `.accept()`) without null-checking first. When the ANTLR4 parser tree contains `None` nodes, these calls crash. **Fix:** Add null-guards in `visitAgValue`, `visitFloatLiteral`, `visitPair`, `visitObj`, and `handleAnnotatedValue`. Also replaces shadowing of builtin `dict` with `d` in `handleAnnotatedValue`, and uses `.get()` for safer key access on parsed vertex/edge dicts. ### 2. `antlr4-python3-runtime==4.11.1` is incompatible with Python >= 3.13 (#2368) The exact version pin `==4.11.1` causes runtime errors on Python 3.13+ due to deprecated/removed CPython internals that ANTLR 4.11.x relies on. **Fix:** Relax the constraint from `==4.11.1` to `>=4.11.1,<5.0` in both `pyproject.toml` and `requirements.txt`. The ANTLR ATN serialized format is unchanged between 4.11 and 4.13, so the generated lexer/parser files are compatible. Validated with `antlr4-python3-runtime==4.13.2` on Python 3.11-3.14. ## Tests Added 9 new test cases in `test_agtypes.py`: - Vertices with large array properties (12 elements) - Vertices with special characters in properties - Deeply nested property structures (3 levels) - Empty properties - Null property values - Edges with complex properties (arrays, booleans) - Paths with multiple edges - Empty/null input handling - Arrays of mixed types including nested arrays All 12 tests pass with `antlr4-python3-runtime==4.13.2`. ## Closes - Closes #2367 - Closes #2368 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
