bpo-9850: Deprecate the macpath module (#1540)
Co-Authored-By: Chi Hsuan Yen <yan12125@gmail.com>.
diff --git a/Lib/macpath.py b/Lib/macpath.py
index a90d105..f85a914 100644
--- a/Lib/macpath.py
+++ b/Lib/macpath.py
@@ -4,6 +4,10 @@
from stat import *
import genericpath
from genericpath import *
+import warnings
+
+warnings.warn('the macpath module is deprecated in 3.7 and will be removed '
+ 'in 3.8', DeprecationWarning, stacklevel=2)
__all__ = ["normcase","isabs","join","splitdrive","split","splitext",
"basename","dirname","commonprefix","getsize","getmtime",
diff --git a/Lib/test/test_macpath.py b/Lib/test/test_macpath.py
index 0698ff5..540bf22 100644
--- a/Lib/test/test_macpath.py
+++ b/Lib/test/test_macpath.py
@@ -1,6 +1,12 @@
-import macpath
from test import test_genericpath
import unittest
+import warnings
+
+
+with warnings.catch_warnings():
+ warnings.filterwarnings("ignore", "the macpath module is deprecated",
+ DeprecationWarning)
+ import macpath
class MacPathTestCase(unittest.TestCase):