Skip to content

Filter reworded torch.jit.script_method warning on Python 3.14#6465

Merged
albertvillanova merged 2 commits into
mainfrom
fix-torch-jit-script-method-py314-warning
Jul 21, 2026
Merged

Filter reworded torch.jit.script_method warning on Python 3.14#6465
albertvillanova merged 2 commits into
mainfrom
fix-torch-jit-script-method-py314-warning

Conversation

@albertvillanova

@albertvillanova albertvillanova commented Jul 20, 2026

Copy link
Copy Markdown
Member

This PR extends the existing PyTorch JIT filterwarnings entry so it also silences the Python 3.14+ variant of the torch.jit.script_method deprecation warning.

Motivation

pyproject.toml already filters the torch.jit.script_method DeprecationWarning, but only its original wording (... is deprecated). On Python 3.14 PyTorch reworded the same deprecation:

DeprecationWarning: torch.jit.script_method is not supported in Python 3.14+ and may break. Please switch to torch.compile or torch.export.

torch/jit/_script.py:359: DeprecationWarning: `torch.jit.script_method` is not supported in Python 3.14+ and may break. Please switch to `torch.compile` or `torch.export`.

Since the message no longer starts with "is deprecated", the existing filter does not match and the warning resurfaces in CI on Python 3.14.

Solution

Add a targeted filterwarnings entry matching the reworded message. Matching stops at `torch.jit.script_method` is not supported so it stays specific to this deprecation (not broad enough to catch unrelated future torch.jit.script_method warnings) while being robust to the Python version number in the text.

Changes

  • Add an ignore entry in pyproject.toml for the torch.jit.script_method "is not supported in Python 3.14+" DeprecationWarning.

Note

Low Risk
Test configuration only; no runtime or library behavior changes.

Overview
Extends pytest filterwarnings in pyproject.toml so CI on Python 3.14+ stays quiet for the same upstream PyTorch JIT deprecation that was already ignored when the message said `torch.jit.script_method` is deprecated.

Adds a second ignore rule matching `torch.jit.script_method` is not supported (plus a short comment), since PyTorch reworded that warning on 3.14 and the old pattern no longer matched.

Reviewed by Cursor Bugbot for commit 07b65bb. Bugbot is set up for automated code reviews on this repo. Configure here.

@bot-ci-comment

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@qgallouedec qgallouedec left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

right!

@albertvillanova
albertvillanova force-pushed the fix-torch-jit-script-method-py314-warning branch from 268f3ea to 07b65bb Compare July 21, 2026 08:36
@albertvillanova
albertvillanova merged commit c4a97ee into main Jul 21, 2026
13 checks passed
@albertvillanova
albertvillanova deleted the fix-torch-jit-script-method-py314-warning branch July 21, 2026 09:28
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