Skip to content

Commit 8ca20cf

Browse files
Remove deprecated shutil.ExecError
1 parent ebf6d9c commit 8ca20cf

4 files changed

Lines changed: 11 additions & 16 deletions

File tree

Doc/whatsnew/3.16.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,21 @@ annotationlib
114114
Use :meth:`annotationlib.ForwardRef.evaluate`
115115
or :func:`typing.evaluate_forward_ref` instead.
116116

117+
shutil
118+
------
119+
120+
* The :class:`!ExecError` exception which has been deprecated since Python 3.14.
121+
It has not been used by any function in :mod:`!shutil` since Python 3.4.
122+
(Contributed by Stan Ulbrych in :gh:`149567`.)
123+
124+
117125
sysconfig
118126
---------
119127

120128
* The :func:`!sysconfig.expand_makefile_vars` function
121129
which has been deprecated since Python 3.14.
122130
Use the ``vars`` argument of :func:`sysconfig.get_paths` instead.
131+
(Contributed by Stan Ulbrych in :gh:`149499`.)
123132

124133
.. Add removals above alphabetically, not here at the end.
125134

Lib/shutil.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1638,15 +1638,3 @@ def which(cmd, mode=os.F_OK | os.X_OK, path=None):
16381638
if _access_check(name, mode):
16391639
return name
16401640
return None
1641-
1642-
def __getattr__(name):
1643-
if name == "ExecError":
1644-
import warnings
1645-
warnings._deprecated(
1646-
"shutil.ExecError",
1647-
f"{warnings._DEPRECATED_MSG}; it "
1648-
"isn't raised by any shutil function.",
1649-
remove=(3, 16)
1650-
)
1651-
return RuntimeError
1652-
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")

Lib/test/test_peepholer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,8 +1127,8 @@ def test_import_from_doesnt_clobber_load_fast_borrow(self):
11271127
def f(self):
11281128
if x: pass
11291129
self.x
1130-
from shutil import ExecError
1131-
print(ExecError)
1130+
from heapq import heapify_max
1131+
print(heapify_max)
11321132
self.assertInBytecode(f, "LOAD_FAST_BORROW", "self")
11331133

11341134
class DirectCfgOptimizerTests(CfgOptimizationTestCase):

Lib/test/test_shutil.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3580,8 +3580,6 @@ def test_module_all_attribute(self):
35803580
if hasattr(os, 'statvfs') or os.name == 'nt':
35813581
target_api.append('disk_usage')
35823582
self.assertEqual(set(shutil.__all__), set(target_api))
3583-
with self.assertWarns(DeprecationWarning):
3584-
from shutil import ExecError # noqa: F401
35853583

35863584

35873585
if __name__ == '__main__':

0 commit comments

Comments
 (0)