Skip to content

Commit 89a1c93

Browse files
authored
bpo-9850: Deprecate the macpath module (#1540)
Co-Authored-By: Chi Hsuan Yen <[email protected]>.
1 parent 981096f commit 89a1c93

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

Doc/library/macpath.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
**Source code:** :source:`Lib/macpath.py`
88

9+
.. deprecated-removed:: 3.7 3.8
10+
911
--------------
1012

1113
This module is the Mac OS 9 (and earlier) implementation of the :mod:`os.path`

Doc/whatsnew/3.7.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,8 @@ Deprecated
265265
now deprecated. It never correctly worked. (Contributed by Serhiy Storchaka
266266
in :issue:`28692`.)
267267

268+
- The :mod:`macpath` is now deprecated and will be removed in Python 3.8.
269+
268270

269271
Changes in the C API
270272
--------------------

Lib/macpath.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
from stat import *
55
import genericpath
66
from genericpath import *
7+
import warnings
8+
9+
warnings.warn('the macpath module is deprecated in 3.7 and will be removed '
10+
'in 3.8', DeprecationWarning, stacklevel=2)
711

812
__all__ = ["normcase","isabs","join","splitdrive","split","splitext",
913
"basename","dirname","commonprefix","getsize","getmtime",

Lib/test/test_macpath.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
import macpath
21
from test import test_genericpath
32
import unittest
3+
import warnings
4+
5+
6+
with warnings.catch_warnings():
7+
warnings.filterwarnings("ignore", "the macpath module is deprecated",
8+
DeprecationWarning)
9+
import macpath
410

511

612
class MacPathTestCase(unittest.TestCase):

0 commit comments

Comments
 (0)