SyntaxWarning for python string \| with sufficiently new python version #114

Closed
opened 2026-01-19 18:29:16 +00:00 by michael · 1 comment
Owner

Originally created by @bernstei on GitHub.

Running generate_guidance.py under python 3.12 leads to many SyntaxWarning, e.g.

./scripts/generate_guidance.py:2112: SyntaxWarning: invalid escape sequence '\|'
  rule_id=rule_yaml['id'].replace('|', '\|'),

It appears that most recent python syntax interprets '\|' as an attempt to escape the |. I think it can be replaced with r'\|' or '\\|', but a, I'm not 100% sure this is right, and b, I'm not sure what python versions this project intends to support and whether they support this new raw string syntax.

Originally created by @bernstei on GitHub. Running `generate_guidance.py` under python 3.12 leads to many `SyntaxWarning`, e.g. ``` ./scripts/generate_guidance.py:2112: SyntaxWarning: invalid escape sequence '\|' rule_id=rule_yaml['id'].replace('|', '\|'), ``` It appears that most recent python syntax interprets `'\|'` as an attempt to escape the `|`. I think it can be replaced with `r'\|'` or `'\\|'`, but a, I'm not 100% sure this is right, and b, I'm not sure what python versions this project intends to support and whether they support this new raw string syntax.
Author
Owner

@robertgendler commented on GitHub:

Merged into the OS branches.

@robertgendler commented on GitHub: Merged into the OS branches.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: usnistgov/macos_security#114