Skip to content

fix invalid escape sequence in regex #69

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

Merged
merged 1 commit into from
Jan 4, 2024

Conversation

deronnax
Copy link

@deronnax deronnax commented Sep 1, 2023

\w without the r prefix is considered an escape sequence, and an invalid one. Invalid escape sequences are a syntax warning and will become syntax errors very soon. It's pretty annoying and is even more since exrex is a dependencies of the popular pydantic_factories python package. It is currently breaking our test suite since we updated to a more up to date environment, with this kind of error:

  File "/Users/mathieu/dev/our-package/.tox/py311/lib/python3.11/site-packages/pydantic_factories/__init__.py", line 3, in <module>
    from .extensions import (
  File "/Users/mathieu/dev/our-package/.tox/py311/lib/python3.11/site-packages/pydantic_factories/extensions/__init__.py", line 2, in <module>
    from .beanie_odm import BeanieDocumentFactory, BeaniePersistenceHandler
  File "/Users/mathieu/dev/our-package/.tox/py311/lib/python3.11/site-packages/pydantic_factories/extensions/beanie_odm.py", line 6, in <module>
    from pydantic_factories.factory import ModelFactory
  File "/Users/mathieu/dev/our-package/.tox/py311/lib/python3.11/site-packages/pydantic_factories/factory.py", line 94, in <module>
    from pydantic_factories.constraints.strings import (
  File "/Users/mathieu/dev/our-package/.tox/py311/lib/python3.11/site-packages/pydantic_factories/constraints/strings.py", line 3, in <module>
    from exrex import getone  # pylint: disable=import-error
    ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mathieu/dev/gg-django/.tox/py311/bin/exrex.py", line 55
    match('\w', unichr(x), U)],
          ^^^^
SyntaxError: invalid escape sequence '\w'

This change is totally safe to merge.

Copy link
Owner

@asciimoo asciimoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks!

@asciimoo asciimoo merged commit 1c22c70 into asciimoo:master Jan 4, 2024
@deronnax
Copy link
Author

deronnax commented Jan 4, 2024

if you could do a release so we can get the fix, that would be awesome ;)

@alejandro-angulo alejandro-angulo mentioned this pull request Oct 3, 2024
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 this pull request may close these issues.

2 participants