fix: resolve Python 3.12 SyntaxWarning for invalid escape sequences - #85
fix: resolve Python 3.12 SyntaxWarning for invalid escape sequences#85Yusuf-Gadelrab wants to merge 2 commits into
Conversation
…y_const.py
The initial commit in this PR fixed araby.py, but three invalid escape
sequences remained elsewhere in the package, so importing pyarabic still
emitted SyntaxWarnings:
- araby_const.py:271 - \w in TOKEN_PATTERN
- trans.py:319 - \s \d \? \! \( \) in a character class
- trans.py:518 - '\RL{' LaTeX delimiter in the __main__ demo
All three are converted to raw strings, which is byte-identical for the
trans.py cases. For araby_const.py the \uXXXX escapes move from Python
to the re module, which supports them identically; equivalence was
verified by differential testing (see PR description).
trans.py CRLF line endings and UTF-8 BOM are preserved.
|
Pushed a follow-up commit that completes this cleanup. What I missed the first time: the original commit only fixed
Reproduced on Verification that the change is behaviour-preserving. For the two Tests: the seven scripts in
No behaviour change is intended and none was observed; this only silences the deprecation |
Summary
Fixes Python 3.12 SyntaxWarnings for invalid escape sequences in regex string literals by converting them to raw strings. Addresses issue #78.
Testing