]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-149567: Remove deprecated `shutil.ExecError` (#149568)
authorStan Ulbrych <stan@python.org>
Fri, 15 May 2026 17:54:05 +0000 (18:54 +0100)
committerGitHub <noreply@github.com>
Fri, 15 May 2026 17:54:05 +0000 (18:54 +0100)
Doc/whatsnew/3.16.rst
Lib/shutil.py
Lib/test/test_peepholer.py
Lib/test/test_shutil.py
Misc/NEWS.d/next/Library/2026-05-08-16-44-20.gh-issue-149567.iiZKEj.rst [new file with mode: 0644]

index 8c06628a082e76f7c8f7e8b912f7c7d60e3cd92f..cff0b8bbe32f0bdec9b918c478990603814894a6 100644 (file)
@@ -141,6 +141,13 @@ mimetypes
   :meth:`mimetypes.MimeTypes.add_type`.
   Undotted extensions now raise a :exc:`ValueError`.
 
+shutil
+------
+
+* The :exc:`!ExecError` exception which has been deprecated since Python 3.14.
+  It has not been used by any function in :mod:`!shutil` since Python 3.4.
+  (Contributed by Stan Ulbrych in :gh:`149567`.)
+
 symtable
 --------
 
@@ -161,6 +168,7 @@ sysconfig
 * The :func:`!sysconfig.expand_makefile_vars` function
   which has been deprecated since Python 3.14.
   Use the ``vars`` argument of :func:`sysconfig.get_paths` instead.
+  (Contributed by Stan Ulbrych in :gh:`149499`.)
 
 tarfile
 -------
index 45cbe4c855b462b1a6a6fee228443f31157de788..cad9b570241f2c3fab37cc831f20606804cf4d99 100644 (file)
@@ -1638,15 +1638,3 @@ def which(cmd, mode=os.F_OK | os.X_OK, path=None):
                 if _access_check(name, mode):
                     return name
     return None
-
-def __getattr__(name):
-    if name == "ExecError":
-        import warnings
-        warnings._deprecated(
-            "shutil.ExecError",
-            f"{warnings._DEPRECATED_MSG}; it "
-            "isn't raised by any shutil function.",
-            remove=(3, 16)
-        )
-        return RuntimeError
-    raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
index d44e61f25f7f552861fc1f7a272eb30471c7563d..61c4ec9b7d5b4a7e337414b806662e2f5131b10a 100644 (file)
@@ -1127,8 +1127,8 @@ class TestMarkingVariablesAsUnKnown(BytecodeTestCase):
         def f(self):
             if x: pass
             self.x
-            from shutil import ExecError
-            print(ExecError)
+            from heapq import heapify_max
+            print(heapify_max)
         self.assertInBytecode(f, "LOAD_FAST_BORROW", "self")
 
 class DirectCfgOptimizerTests(CfgOptimizationTestCase):
index 13a3487382dfcfb589ca6a272576bb27ba89a482..59cb319b0a95b5e8e4d9a796562604920f5ab641 100644 (file)
@@ -3580,8 +3580,6 @@ class PublicAPITests(unittest.TestCase):
         if hasattr(os, 'statvfs') or os.name == 'nt':
             target_api.append('disk_usage')
         self.assertEqual(set(shutil.__all__), set(target_api))
-        with self.assertWarns(DeprecationWarning):
-            from shutil import ExecError  # noqa: F401
 
 
 if __name__ == '__main__':
diff --git a/Misc/NEWS.d/next/Library/2026-05-08-16-44-20.gh-issue-149567.iiZKEj.rst b/Misc/NEWS.d/next/Library/2026-05-08-16-44-20.gh-issue-149567.iiZKEj.rst
new file mode 100644 (file)
index 0000000..e30563d
--- /dev/null
@@ -0,0 +1,2 @@
+Remove the :exc:`!shutil.ExecError` exception which has been deprecated
+since Python 3.14.