Skip to content

Improve deprecation messages for backported deprecations#16062

Merged
AlexWaygood merged 2 commits into
mainfrom
improve-deprecation-messages
Jul 21, 2026
Merged

Improve deprecation messages for backported deprecations#16062
AlexWaygood merged 2 commits into
mainfrom
improve-deprecation-messages

Conversation

@AlexWaygood

@AlexWaygood AlexWaygood commented Jul 21, 2026

Copy link
Copy Markdown
Member

Summary

#15750 intentionally backported several deprecations to older Python versions. But a message such as "Deprecated since Python 3.14" is now confusing if you're running a type checker with --python-version=3.13, for example -- it looks like a bug, even though it isn't. We had a user report this on Discord for ty: https://discord.com/channels/1039017663004942429/1279201882337705994/1529152755644502076.

This updates those messages to:

  • remove misleading version-of-deprecation claims for these "time-travelling" deprecations
  • add the Python 3.17 removal date for the deprecated tkinter.Variable trace methods;
  • briefly explain the deprecation reasons for a few particularly problematic APIs, including argparse.FileType, CGIHTTPRequestHandler, importlib.resources.contents, and nturl2path.

@AlexWaygood
AlexWaygood marked this pull request as ready for review July 21, 2026 16:28
@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

aiohttp (https://github.com/aio-libs/aiohttp)
- aiohttp/worker.py:253:9: error: function asyncio.events.set_event_loop_policy is deprecated: Deprecated since Python 3.14; will be removed in Python 3.16.  [deprecated]
+ aiohttp/worker.py:253:9: error: function asyncio.events.set_event_loop_policy is deprecated: Deprecated; will be removed in Python 3.16.  [deprecated]

@AlexWaygood
AlexWaygood merged commit f497b0b into main Jul 21, 2026
73 checks passed
@AlexWaygood
AlexWaygood deleted the improve-deprecation-messages branch July 21, 2026 16:44
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