diff options
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | doc/whatsnew/2.13.rst | 2 | ||||
-rw-r--r-- | pylint/checkers/stdlib.py | 7 | ||||
-rw-r--r-- | tests/functional/d/deprecated/deprecated_module_py310.py | 4 | ||||
-rw-r--r-- | tests/functional/d/deprecated/deprecated_module_py310.rc | 2 | ||||
-rw-r--r-- | tests/functional/d/deprecated/deprecated_module_py310.txt | 1 | ||||
-rw-r--r-- | tests/functional/r/regression_02/regression_distutil_import_error_73.py | 2 |
7 files changed, 19 insertions, 1 deletions
@@ -405,6 +405,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 diff --git a/doc/whatsnew/2.13.rst b/doc/whatsnew/2.13.rst index 6fe17d995..a0e5273db 100644 --- a/doc/whatsnew/2.13.rst +++ b/doc/whatsnew/2.13.rst @@ -392,6 +392,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 diff --git a/pylint/checkers/stdlib.py b/pylint/checkers/stdlib.py index 864abf734..8270eb88c 100644 --- a/pylint/checkers/stdlib.py +++ b/pylint/checkers/stdlib.py @@ -79,6 +79,7 @@ DEPRECATED_MODULES = { (3, 6, 0): {"asynchat", "asyncore"}, (3, 7, 0): {"macpath"}, (3, 9, 0): {"lib2to3", "parser", "symbol", "binhex"}, + (3, 10, 0): {"distutils"}, } DEPRECATED_ARGUMENTS = { @@ -126,6 +127,7 @@ DEPRECATED_DECORATORS = { "abc.abstractstaticmethod", "abc.abstractproperty", }, + (3, 4, 0): {"importlib.util.module_for_loader"}, } @@ -205,6 +207,10 @@ DEPRECATED_METHODS: Dict = { }, (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", @@ -253,6 +259,7 @@ DEPRECATED_METHODS: Dict = { }, (3, 10, 0): { "_sqlite3.enable_shared_cache", + "importlib.abc.Finder.find_module", "pathlib.Path.link_to", "zipimport.zipimporter.load_module", "zipimport.zipimporter.find_module", diff --git a/tests/functional/d/deprecated/deprecated_module_py310.py b/tests/functional/d/deprecated/deprecated_module_py310.py new file mode 100644 index 000000000..832147476 --- /dev/null +++ b/tests/functional/d/deprecated/deprecated_module_py310.py @@ -0,0 +1,4 @@ +"""Test deprecated modules from Python 3.10.""" +# pylint: disable=unused-import + +import distutils # [deprecated-module] diff --git a/tests/functional/d/deprecated/deprecated_module_py310.rc b/tests/functional/d/deprecated/deprecated_module_py310.rc new file mode 100644 index 000000000..b29fd450a --- /dev/null +++ b/tests/functional/d/deprecated/deprecated_module_py310.rc @@ -0,0 +1,2 @@ +[testoptions] +min_pyver = 3.10 diff --git a/tests/functional/d/deprecated/deprecated_module_py310.txt b/tests/functional/d/deprecated/deprecated_module_py310.txt new file mode 100644 index 000000000..a46667aa5 --- /dev/null +++ b/tests/functional/d/deprecated/deprecated_module_py310.txt @@ -0,0 +1 @@ +deprecated-module:4:0:4:16::Uses of a deprecated module 'distutils':UNDEFINED diff --git a/tests/functional/r/regression_02/regression_distutil_import_error_73.py b/tests/functional/r/regression_02/regression_distutil_import_error_73.py index 751a4980f..d40c0973f 100644 --- a/tests/functional/r/regression_02/regression_distutil_import_error_73.py +++ b/tests/functional/r/regression_02/regression_distutil_import_error_73.py @@ -7,7 +7,7 @@ https://github.com/PyCQA/pylint/issues/2955 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 |