Project

General

Profile

Actions

Bug #365

closed

generate_packets.py invalid escape sequence warnings

Added by Marko Lindqvist 7 months ago. Updated 6 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Bootstrap
Target version:
Start date:
03/28/2024
Due date:
% Done:

0%

Estimated time:

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

Actions #1

Updated by Marko Lindqvist 7 months ago

Seen at least in S3_1.

Actions #2

Updated by Alina Lenk 7 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.

Actions #3

Updated by Alina Lenk 7 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.

Actions #4

Updated by Alina Lenk 7 months ago

Actions #5

Updated by Alina Lenk 6 months ago

  • Status changed from In Review to Closed
Actions

Also available in: Atom PDF