Bug #365
closed
generate_packets.py invalid escape sequence warnings
Added by Marko Lindqvist 8 months ago.
Updated 7 months ago.
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
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.
- 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.
- Status changed from In Review to Closed
Also available in: Atom
PDF