Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxWarning with Python 3.12 and newer #769

Open
rhertzog opened this issue Nov 6, 2024 · 0 comments
Open

SyntaxWarning with Python 3.12 and newer #769

rhertzog opened this issue Nov 6, 2024 · 0 comments

Comments

@rhertzog
Copy link
Contributor

rhertzog commented Nov 6, 2024

With Python 3.12 and newer you get SyntaxWarning warnings when byte-compiling the hamster's code:

  /usr/lib/python3/dist-packages/hamster/lib/datetime.py:471:
SyntaxWarning: invalid escape sequence '\s'
    position="exact", separator="\s+", default_day=None, ref="now"):
  /usr/lib/python3/dist-packages/hamster/lib/datetime.py:472:
SyntaxWarning: invalid escape sequence '\s'
    """Parse a start-end range from text.
  /usr/lib/python3/dist-packages/hamster/widgets/activityentry.py:381:
SyntaxWarning: invalid escape sequence '\s'
    fragments = [f for f in re.split("[\s|#]", text)]
  /usr/lib/python3/dist-packages/hamster/widgets/timeinput.py:141:
SyntaxWarning: invalid escape sequence '\D'
    numbers = re.split("\D", str_time)

All those strings should be turned into regexp-quoted strings (with a leading r): r"\s+" for example.

(Initially reported in Debian here: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1085633)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant