Skip to content

Conversation

@cdce8p
Copy link
Member

@cdce8p cdce8p commented Oct 10, 2025

Description

Similar to #2386
Python 3.14 added a few more syntax warnings for return in finally PEP 765 which are emitted during AST parsing. Similarly the message for invalid escape sequence changed slightly so the regex didn't match anymore.

# test.py
def func() -> None:
    try:
        x = 1/0
    finally:
        return None  # return in finally

"Hello \P world"  # invalid escape sequence

Python 3.13

# python3.13 test.py
test.py:7: SyntaxWarning: invalid escape sequence '\P'
  "Hello \P world"  # invalid escape sequence

Python3.13

# python3.14 test.py
test.py:7: SyntaxWarning: "\P" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\\P"? A raw string is also an option.
  "Hello \P world"  # invalid escape sequence
test.py:5: SyntaxWarning: 'return' in a 'finally' block
  return None  # return in finally

@codecov
Copy link

codecov bot commented Oct 10, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.33%. Comparing base (7fce264) to head (911532a).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2853   +/-   ##
=======================================
  Coverage   93.33%   93.33%           
=======================================
  Files          92       92           
  Lines       11168    11170    +2     
=======================================
+ Hits        10424    10426    +2     
  Misses        744      744           
Flag Coverage Δ
linux 93.20% <100.00%> (+<0.01%) ⬆️
pypy 93.33% <100.00%> (+<0.01%) ⬆️
windows 93.32% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
astroid/builder.py 95.17% <100.00%> (+0.04%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

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

Great !

@Pierre-Sassoulas Pierre-Sassoulas merged commit 8c4da6a into pylint-dev:main Oct 10, 2025
22 checks passed
pylint-backport bot pushed a commit that referenced this pull request Oct 10, 2025
@cdce8p cdce8p deleted the suppress-syntax-warnings branch October 10, 2025 20:00
Pierre-Sassoulas pushed a commit that referenced this pull request Oct 10, 2025
…when parsing modules (#2854)

Suppress SyntaxWarnings for Python 3.14 when parsing modules (#2853)

(cherry picked from commit 8c4da6a)

Co-authored-by: Marc Mueller <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants