Bug #365
closedgenerate_packets.py invalid escape sequence warnings
0%
Description
Lately running generate_packets.py has started to give bunch of "invalid escape sequence" -warnings on some environments. Maybe those with python-3.12?
Files
Updated by Alina Lenk 8 months ago
Marko Lindqvist wrote:
Maybe those with python-3.12?
Changelog suggests that with 3.12, the (usually-silent) DeprecationWarning
for invalid escape sequences got upgraded to a SyntaxWarning
. Presumably, running the script on older platforms with deprecation warnings enabled would also produce those warnings.
There are a few spots (making chars and strings in the generated C code) where '
and "
are explicitly escaped (\'
, \"
) in triple-quoted multiline strings where that wouldn't be necessary (the ones starting at lines 1609, 1685 and 1945). The language reference doesn't suggest that these would count as invalid escape sequences (\'
and \"
are listed as escape sequences with no notes), but I haven't verified this; and either way, those extra backslashes are superfluous and could be dropped.
Updated by Alina Lenk 8 months ago
- Target version set to 3.1.1
Alina Lenk wrote in #note-2:
The language reference doesn't suggest that these would count as invalid escape sequences
At least with Python 3.12.2 on Windows, superfluously-escaped \"
and \'
do not raise SyntaxWarning
, so this isn't it. Might be worth cleaning those up anyway, but it's not the cause of this issue.
Looks like only the S3_1 version (and older, presumably), i.e. the old script, produces any warnings at all. A cursory glance suggests this is probably down to regexes not written as r-strings.
Updated by Alina Lenk 8 months ago
- File 0001-generate_packets.py-Mark-regexes-as-raw-strings-to-f.patch 0001-generate_packets.py-Mark-regexes-as-raw-strings-to-f.patch added
- Status changed from New to In Review
- Assignee set to Alina Lenk