]> granicus.if.org Git - python/commitdiff
bpo-9850: Deprecate the macpath module (#1540)
authorVictor Stinner <victor.stinner@gmail.com>
Mon, 15 May 2017 09:01:21 +0000 (11:01 +0200)
committerGitHub <noreply@github.com>
Mon, 15 May 2017 09:01:21 +0000 (11:01 +0200)
Co-Authored-By: Chi Hsuan Yen <yan12125@gmail.com>.
Doc/library/macpath.rst
Doc/whatsnew/3.7.rst
Lib/macpath.py
Lib/test/test_macpath.py

index b08bbe08093dab800c48cd611d1f248e28f1043b..2af51c66c50a356ffea347fe02a4468d2ac51271 100644 (file)
@@ -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`
index 3a001d7b4482ad9c0fbb220b6f41ec457f0cfa74..8e5ac5246c03105139abdc106c2a3edfb05cd1b6 100644 (file)
@@ -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
 --------------------
index a90d1053bc83d084e2e35867936fe7cf531e46d8..f85a91435b90446d68f886ca05bdcae0eedbc897 100644 (file)
@@ -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",
index 0698ff5f6b59c22e1a33fcda28ec87fd1a8e4a37..540bf2200c191315b1598f3c5d8b0ce7edcdfdeb 100644 (file)
@@ -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):