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

Python 3.12 and 3.13 emit "SyntaxWarning: invalid escape sequence" #7

Open
hacklschorsch opened this issue Jan 16, 2025 · 0 comments · May be fixed by #8
Open

Python 3.12 and 3.13 emit "SyntaxWarning: invalid escape sequence" #7

hacklschorsch opened this issue Jan 16, 2025 · 0 comments · May be fixed by #8

Comments

@hacklschorsch
Copy link
Member

hacklschorsch commented Jan 16, 2025

Similar to https://tahoe-lafs.org/trac/tahoe-lafs/ticket/4158 and tahoe-lafs/tahoe-lafs#1427:

From https://stackoverflow.com/a/77531416/1181063:

Back in Python 3.6, using invalid escape sequences in string literals was deprecated (bpo-27364). Since then, attempting to use an invalid escape sequence has emitted a DeprecationWarning. This can often go unnoticed if you don't run Python with warnings enabled. DeprecationWarnings are silenced by default.

Python 3.12 upgraded the DeprecationWarning to a SyntaxWarning. SyntaxWarnings are emitted by the compiler when the code is parsed, not when it's being run, so they cannot be ignored using a runtime warning filter. Unlike DeprecationWarnings, SyntaxWarnings are displayed by default, which is why you're seeing it now. This increase in visibility was intentional. In a future version of Python, using invalid escape sequences in string literals is planned to eventually become a hard SyntaxError.

Setting up python3-txi2p-tahoe (0.3.7-3) ...
/usr/lib/python3/dist-packages/txi2p/test/test_plugins.py:69: SyntaxWarning: invalid escape sequence '\:'
  MemoryReactor(), "i2p:stats.i2p:apiEndpoint=tcp\:127.0.0.1\:2827")
/usr/lib/python3/dist-packages/txi2p/test/test_plugins.py:81: SyntaxWarning: invalid escape sequence '\:'
  MemoryReactor(), "i2p:stats.i2p:api=BOB:tunnelNick=spam:inport=12345:options=inbound.length\:5,outbound.length\:5")
/usr/lib/python3/dist-packages/txi2p/test/test_plugins.py:93: SyntaxWarning: invalid escape sequence '\:'
  MemoryReactor(), "i2p:stats.i2p:81:api=SAM:localPort=34444:options=inbound.length\:5,outbound.length\:5:sigType=foobar")
/usr/lib/python3/dist-packages/txi2p/test/test_plugins.py:125: SyntaxWarning: invalid escape sequence '\:'
  MemoryReactor(), "i2p:/tmp/testkeys.foo:apiEndpoint=tcp\:127.0.0.1\:2827")
/usr/lib/python3/dist-packages/txi2p/test/test_plugins.py:137: SyntaxWarning: invalid escape sequence '\:'
  MemoryReactor(), "i2p:/tmp/testkeys.foo:api=BOB:tunnelNick=spam:outport=23456:options=inbound.length\:5,outbound.length\:5")
/usr/lib/python3/dist-packages/txi2p/test/test_plugins.py:149: SyntaxWarning: invalid escape sequence '\:'
  MemoryReactor(), "i2p:/tmp/testkeys.foo:81:api=SAM:options=inbound.length\:5,outbound.length\:5:sigType=foobar")
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

Successfully merging a pull request may close this issue.

1 participant