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

deprecation warnings on python 3.9 #164

Open
wbolster opened this issue Mar 8, 2021 · 5 comments
Open

deprecation warnings on python 3.9 #164

wbolster opened this issue Mar 8, 2021 · 5 comments

Comments

@wbolster
Copy link

wbolster commented Mar 8, 2021

importing the vobject module using python 3.9 results in these warnings:

DeprecationWarning: invalid escape sequence

details:

../../../usr/local/lib/python3.9/site-packages/vobject/base.py:736
  /usr/local/lib/python3.9/site-packages/vobject/base.py:736: DeprecationWarning: invalid escape sequence \-
    patterns['name'] = '[a-zA-Z0-9\-_]+'
../../../usr/local/lib/python3.9/site-packages/vobject/base.py:1219
  /usr/local/lib/python3.9/site-packages/vobject/base.py:1219: DeprecationWarning: invalid escape sequence \;
    s = s.replace("\\", "\\\\").replace(";", "\;").replace(",", "\,")
@da4089
Copy link
Collaborator

da4089 commented Feb 27, 2024

@wbolster, I'm unable to reproduce this using Python 3.9.18 and current GitHub code (which is unchanged from the lines quoted above).

Are you able to confirm it is happening for you still?

@wbolster
Copy link
Author

are you sure warnings are actually shown? i can reproduce this with py39 – py312:

$ python3.9 -Wa -c "'[a-zA-Z0-9\-_]+'"
<string>:1: DeprecationWarning: invalid escape sequence \-

$ python3.10 -Wa -c "'[a-zA-Z0-9\-_]+'"
<string>:1: DeprecationWarning: invalid escape sequence '\-'

$ python3.11 -Wa -c "'[a-zA-Z0-9\-_]+'"
<string>:1: DeprecationWarning: invalid escape sequence '\-'

$ python3.12 -Wa -c "'[a-zA-Z0-9\-_]+'"
<string>:1: SyntaxWarning: invalid escape sequence '\-'

note how py312 turned it from DeprecationWarning into SyntaxWarning

@da4089
Copy link
Collaborator

da4089 commented Feb 27, 2024

I see that too (using -Wa), but actually importing the vobject module doesn't show those warnings. Which is a little odd, because vobject.base.patterns['name'] is initialized, so it has been parsed.

da4089 added a commit to da4089/vobject that referenced this issue Feb 27, 2024
Python 3.6 began reporting a DeprecationWarning for the use of
backslash escape sequence where the second character isn't a valid
Python escape sequence.  Unlike C, in Python, the result of this is
both characters (not just the second).

Python 3.12 changed that to a SyntaxWarning, the final step before
making it a SyntaxError.  So, we should fix it now.

First reported as skarim#164
@da4089
Copy link
Collaborator

da4089 commented Feb 27, 2024

Fixed in py-vobject#21, thanks for the report!

@wbolster
Copy link
Author

thanks!

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