Skip to content

Fix deprecated-class losing classes of modules listed for several versions - #11764

Open
YashG1836 wants to merge 1 commit into
pylint-dev:mainfrom
YashG1836:deprecated-class-merge-versions
Open

YashG1836 wants to merge 1 commit into
pylint-dev:mainfrom
YashG1836:deprecated-class-merge-versions

Conversation

@YashG1836

Copy link
Copy Markdown

Type of Changes

Type
✓ 🐛 Bug fix

Description

DEPRECATED_CLASSES maps a Python version to {module: {classes}}. The checker built its table with dict.update, so when a module is listed under more than one version, the newer set of classes replaced the older one. Five modules are affected: typing, asyncio, importlib.abc, ast and webbrowser.

For example, on Python 3.14 only typing._UnionGenericAlias and the 3.14 asyncio event loop policies are left, so typing.ByteString, typing.Text, typing.Hashable, the asyncio child watchers and importlib.abc.Finder are no longer reported. On Python 3.15 the ast node classes and webbrowser.MacOSX would be lost too.

The fix merges the sets for each module instead of replacing them.

Test: deprecated_class_py314 (Python 3.14+) imports or calls one class from each affected module. It fails on main (only DefaultEventLoopPolicy is reported) and passes with the fix. The changed lines are fully covered, and the functional and checker tests pass (1401 passed).

Closes #11763

…sions

When a module appears in DEPRECATED_CLASSES under more than one Python
version, dict.update replaced its older set of classes with the newer one.
Merge the sets instead, so classes like typing.ByteString and
asyncio.SafeChildWatcher are reported again on Python 3.14.

Closes pylint-dev#11763

This branch has not been deployed

No deployments
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.

deprecated-class misses classes when a module is listed for more than one Python version

1 participant