summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-05-15 09:01:21 (GMT)
committerGitHub <noreply@github.com>2017-05-15 09:01:21 (GMT)
commit89a1c93f046f9726310f8362227be7b8e50eea22 (patch)
tree5c862a5d2a6abab0ad25e159865720fb8364661d
parent981096f98b9c131594b0ac85ad01b63cbd11aa0a (diff)
downloadcpython-89a1c93f046f9726310f8362227be7b8e50eea22.zip
cpython-89a1c93f046f9726310f8362227be7b8e50eea22.tar.gz
cpython-89a1c93f046f9726310f8362227be7b8e50eea22.tar.bz2
bpo-9850: Deprecate the macpath module (#1540)
Co-Authored-By: Chi Hsuan Yen <yan12125@gmail.com>.
-rw-r--r--Doc/library/macpath.rst2
-rw-r--r--Doc/whatsnew/3.7.rst2
-rw-r--r--Lib/macpath.py4
-rw-r--r--Lib/test/test_macpath.py8
4 files changed, 15 insertions, 1 deletions
diff --git a/Doc/library/macpath.rst b/Doc/library/macpath.rst
index b08bbe0..2af51c6 100644
--- a/Doc/library/macpath.rst
+++ b/Doc/library/macpath.rst
@@ -6,6 +6,8 @@
**Source code:** :source:`Lib/macpath.py`
+.. deprecated-removed:: 3.7 3.8
+
--------------
This module is the Mac OS 9 (and earlier) implementation of the :mod:`os.path`
diff --git a/Doc/whatsnew/3.7.rst b/Doc/whatsnew/3.7.rst
index 3a001d7..8e5ac52 100644
--- a/Doc/whatsnew/3.7.rst
+++ b/Doc/whatsnew/3.7.rst
@@ -265,6 +265,8 @@ Deprecated
now deprecated. It never correctly worked. (Contributed by Serhiy Storchaka
in :issue:`28692`.)
+- The :mod:`macpath` is now deprecated and will be removed in Python 3.8.
+
Changes in the C API
--------------------
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 @@ import os
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):