[Python-checkins] bpo-44464: Remove special exclusion for flake8 in the deprecation warnings. (#26807)

jaraco webhook-mailer at python.org
Sun Jun 27 17:59:31 EDT 2021


https://github.com/python/cpython/commit/efe7d08d178a7c09bcca994f2068b019c8633d83
commit: efe7d08d178a7c09bcca994f2068b019c8633d83
branch: main
author: Jason R. Coombs <jaraco at jaraco.com>
committer: jaraco <jaraco at jaraco.com>
date: 2021-06-27T17:59:18-04:00
summary:

bpo-44464: Remove special exclusion for flake8 in the deprecation warnings. (#26807)

Sync with importlib_metadata 4.6.

files:
A Misc/NEWS.d/next/Library/2021-06-19-21-52-27.bpo-44464.U2oa-a.rst
M Doc/whatsnew/3.10.rst
M Lib/importlib/metadata/__init__.py

diff --git a/Doc/whatsnew/3.10.rst b/Doc/whatsnew/3.10.rst
index 2a43d2686e3fb..81481327b43e9 100644
--- a/Doc/whatsnew/3.10.rst
+++ b/Doc/whatsnew/3.10.rst
@@ -1084,7 +1084,7 @@ and will be incorrect in some rare cases, including some ``_``-s in
 importlib.metadata
 ------------------
 
-Feature parity with ``importlib_metadata`` 4.4
+Feature parity with ``importlib_metadata`` 4.6
 (`history <https://importlib-metadata.readthedocs.io/en/latest/history.html>`_).
 
 :ref:`importlib.metadata entry points <entry-points>`
diff --git a/Lib/importlib/metadata/__init__.py b/Lib/importlib/metadata/__init__.py
index d2116cfe6f7d6..f5172eefc1841 100644
--- a/Lib/importlib/metadata/__init__.py
+++ b/Lib/importlib/metadata/__init__.py
@@ -362,14 +362,6 @@ def _parse_groups(text):
         )
 
 
-def flake8_bypass(func):
-    # defer inspect import as performance optimization.
-    import inspect
-
-    is_flake8 = any('flake8' in str(frame.filename) for frame in inspect.stack()[:5])
-    return func if not is_flake8 else lambda: None
-
-
 class Deprecated:
     """
     Compatibility add-in for mapping to indicate that
@@ -405,7 +397,7 @@ def __getitem__(self, name):
         return super().__getitem__(name)
 
     def get(self, name, default=None):
-        flake8_bypass(self._warn)()
+        self._warn()
         return super().get(name, default)
 
     def __iter__(self):
diff --git a/Misc/NEWS.d/next/Library/2021-06-19-21-52-27.bpo-44464.U2oa-a.rst b/Misc/NEWS.d/next/Library/2021-06-19-21-52-27.bpo-44464.U2oa-a.rst
new file mode 100644
index 0000000000000..6b1c10783d569
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2021-06-19-21-52-27.bpo-44464.U2oa-a.rst
@@ -0,0 +1,2 @@
+Remove exception for flake8 in deprecated importlib.metadata interfaces.
+Sync with importlib_metadata 4.6.



More information about the Python-checkins mailing list