Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ What's New in astroid 4.0.1?
Release date: TBA


* Suppress ``SyntaxWarning`` for invalid escape sequences and return in finally on
Python 3.14 when parsing modules.


What's New in astroid 4.0.0?
============================
Expand Down
8 changes: 6 additions & 2 deletions astroid/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

from astroid import bases, modutils, nodes, raw_building, rebuilder, util
from astroid._ast import ParserModule, get_parser_module
from astroid.const import PY312_PLUS
from astroid.const import PY312_PLUS, PY314_PLUS
from astroid.exceptions import AstroidBuildingError, AstroidSyntaxError, InferenceError

if TYPE_CHECKING:
Expand All @@ -39,7 +39,11 @@
_STATEMENT_SELECTOR = "#@"

if PY312_PLUS:
warnings.filterwarnings("ignore", "invalid escape sequence", SyntaxWarning)
warnings.filterwarnings("ignore", ".*invalid escape sequence", SyntaxWarning)
if PY314_PLUS:
warnings.filterwarnings(
"ignore", "'(return|continue|break)' in a 'finally'", SyntaxWarning
)


def open_source_file(filename: str) -> tuple[TextIOWrapper, str, str]:
Expand Down