Skip to content

Add distutils to deprecated modules #5864

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,8 @@ Release date: TBA

Closes #5862

* Importing the deprecated stdlib module ``distutils`` now emits ``deprecated_module`` on Python 3.10+.

* ``missing-raises-doc`` will now check the class hierarchy of the raised exceptions

.. code-block:: python
Expand Down
2 changes: 2 additions & 0 deletions doc/whatsnew/2.13.rst
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,8 @@ Other Changes

Closes #5862

* Importing the deprecated stdlib module ``distutils`` now emits ``deprecated_module`` on Python 3.10+.

* Fixed false positive ``unexpected-keyword-arg`` for decorators.

Closes #258
Expand Down
7 changes: 7 additions & 0 deletions pylint/checkers/stdlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
(3, 6, 0): {"asynchat", "asyncore"},
(3, 7, 0): {"macpath"},
(3, 9, 0): {"lib2to3", "parser", "symbol", "binhex"},
(3, 10, 0): {"distutils"},
}

DEPRECATED_ARGUMENTS = {
Expand Down Expand Up @@ -126,6 +127,7 @@
"abc.abstractstaticmethod",
"abc.abstractproperty",
},
(3, 4, 0): {"importlib.util.module_for_loader"},
}


Expand Down Expand Up @@ -205,6 +207,10 @@
},
(3, 4, 0): {
"importlib.find_loader",
"importlib.abc.Loader.load_module",
"importlib.abc.Loader.module_repr",
"importlib.abc.PathEntryFinder.find_loader",
"importlib.abc.PathEntryFinder.find_module",
"plistlib.readPlist",
"plistlib.writePlist",
"plistlib.readPlistFromBytes",
Expand Down Expand Up @@ -253,6 +259,7 @@
},
(3, 10, 0): {
"_sqlite3.enable_shared_cache",
"importlib.abc.Finder.find_module",
"pathlib.Path.link_to",
"zipimport.zipimporter.load_module",
"zipimport.zipimporter.find_module",
Expand Down
4 changes: 4 additions & 0 deletions tests/functional/d/deprecated/deprecated_module_py310.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"""Test deprecated modules from Python 3.10."""
# pylint: disable=unused-import

import distutils # [deprecated-module]
2 changes: 2 additions & 0 deletions tests/functional/d/deprecated/deprecated_module_py310.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[testoptions]
min_pyver = 3.10
1 change: 1 addition & 0 deletions tests/functional/d/deprecated/deprecated_module_py310.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deprecated-module:4:0:4:16::Uses of a deprecated module 'distutils':UNDEFINED
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
https://github.com/PyCQA/astroid/pull/1321
"""

# pylint: disable=unused-import
# pylint: disable=unused-import, deprecated-module

import distutils.version
from distutils.util import strtobool
Expand Down