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

syntax warnings about invalid escape sequences #738

Open
dnebauer opened this issue Jul 14, 2024 · 0 comments
Open

syntax warnings about invalid escape sequences #738

dnebauer opened this issue Jul 14, 2024 · 0 comments

Comments

@dnebauer
Copy link

Running offlineimap recently began showing the following warnings:

/usr/lib/python3/dist-packages/imaplib2.py:2472: SyntaxWarning: invalid escape sequence '\D'
  ('store', ('1', 'FLAGS', '(\Deleted)')),
/usr/lib/python3/dist-packages/imaplib2.py:2577: SyntaxWarning: invalid escape sequence '\D'
  run('uid', ('STORE', uid[-1], 'FLAGS', '(\Deleted)'))
/usr/lib/python3/dist-packages/imaplib2.py:2591: SyntaxWarning: invalid escape sequence '\S'
  run('store', (num, '-FLAGS', '(\Seen)'), cb=False),
/usr/lib/python3/dist-packages/imaplib2.py:2594: SyntaxWarning: invalid escape sequence '\D'
  run('uid', ('STORE', num, 'FLAGS', '(\Deleted)'))

The corresponding lines from imaplib2.py are

2472:

    ('store', ('1', 'FLAGS', '(\Deleted)')),

2577:

            run('uid', ('STORE', uid[-1], 'FLAGS', '(\Deleted)'))

2591:

            run('store', (num, '-FLAGS', '(\Seen)'), cb=False),

2594:

            run('uid', ('STORE', num, 'FLAGS', '(\Deleted)'))

It seems using invalid escape sequences in string literals has been deprecated since Python 3.6, following which it would generate a DeprecationWarning, and deprecation warnings may not be displayed by default.

With Python 3.12 this use of invalid escape sequences was upgraded to a SyntaxWarning, which is displayed by default.

Aside from making the running of offlineimap "noisy", this change would not matter except for claims that the use of invalid escape sequences in string literals is planned to eventually become a hard SyntaxError.

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

2 participants
@dnebauer and others