skarim / vobject

A full-featured Python package for parsing and creating iCalendar and vCard files
https://vobject.sameenkarim.com
255 stars 93 forks source link

deprecation warnings on python 3.9 #164

Open wbolster opened 3 years ago

wbolster commented 3 years ago

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 commented 8 months ago

@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 commented 8 months ago

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 commented 8 months ago

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 commented 8 months ago

Fixed in https://github.com/py-vobject/vobject/pull/21, thanks for the report!

wbolster commented 8 months ago

thanks!