Skip to content

SyntaxWarnings with Python 3.14.2 #179

@frnidito

Description

@frnidito

Python 3.14.2 issues warnings because of the missing escapes / "r"-prefix for some of the regular expressions in use.

During the move to 3.14.2 in our company, running pytest issues the following warnings:

../usr/local/lib/python3.14/site-packages/sql_formatter/core.py:188
../usr/local/lib/python3.14/site-packages/sql_formatter/core.py:188
../usr/local/lib/python3.14/site-packages/sql_formatter/core.py:188
../usr/local/lib/python3.14/site-packages/sql_formatter/core.py:188
../usr/local/lib/python3.14/site-packages/sql_formatter/core.py:188
../usr/local/lib/python3.14/site-packages/sql_formatter/core.py:188
../usr/local/lib/python3.14/site-packages/sql_formatter/core.py:188
../usr/local/lib/python3.14/site-packages/sql_formatter/core.py:188
../usr/local/lib/python3.14/site-packages/sql_formatter/core.py:188
  /usr/local/lib/python3.14/site-packages/sql_formatter/core.py:188: SyntaxWarning: "\w" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\\w"? A raw string is also an option.
    function_re = re.compile("[\w\d]+\(")

../usr/local/lib/python3.14/site-packages/sql_formatter/core.py:443
../usr/local/lib/python3.14/site-packages/sql_formatter/core.py:443
../usr/local/lib/python3.14/site-packages/sql_formatter/core.py:443
../usr/local/lib/python3.14/site-packages/sql_formatter/core.py:443
../usr/local/lib/python3.14/site-packages/sql_formatter/core.py:443
../usr/local/lib/python3.14/site-packages/sql_formatter/core.py:443
../usr/local/lib/python3.14/site-packages/sql_formatter/core.py:443
../usr/local/lib/python3.14/site-packages/sql_formatter/core.py:443
../usr/local/lib/python3.14/site-packages/sql_formatter/core.py:443
  /usr/local/lib/python3.14/site-packages/sql_formatter/core.py:443: SyntaxWarning: "\w" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\\w"? A raw string is also an option.
    split_c[0]["string"] = re.sub("(.*[\w\d]+)(\s*)$", r"\1;\2", split_c[0]["string"])

../usr/local/lib/python3.14/site-packages/sql_formatter/utils.py:700
../usr/local/lib/python3.14/site-packages/sql_formatter/utils.py:700
../usr/local/lib/python3.14/site-packages/sql_formatter/utils.py:700
../usr/local/lib/python3.14/site-packages/sql_formatter/utils.py:700
../usr/local/lib/python3.14/site-packages/sql_formatter/utils.py:700
../usr/local/lib/python3.14/site-packages/sql_formatter/utils.py:700
../usr/local/lib/python3.14/site-packages/sql_formatter/utils.py:700
../usr/local/lib/python3.14/site-packages/sql_formatter/utils.py:700
../usr/local/lib/python3.14/site-packages/sql_formatter/utils.py:700
  /usr/local/lib/python3.14/site-packages/sql_formatter/utils.py:700: SyntaxWarning: "\[" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\\["? A raw string is also an option.
    "\[CS\]",

Not knowing how to classify this, I opened a "generic" issue but I am happy to change it to what is preferred by the maintainers of the project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions