Skip to content

Commit f27489c

Browse files
committed
Deprecate nturl2path
1 parent 90e597d commit f27489c

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

Doc/whatsnew/3.14.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,6 +1135,11 @@ Deprecated
11351135
or *sequence* as keyword arguments is now deprecated.
11361136
(Contributed by Kirill Podoprigora in :gh:`121676`.)
11371137

1138+
* :mod:`!nturl2path`: This module is now deprecated. Call
1139+
:func:`urllib.request.url2pathname` and :func:`~urllib.request.pathname2url`
1140+
instead.
1141+
(Contributed by Barney Gale in gh:`125866`.)
1142+
11381143
* :mod:`os`:
11391144
:term:`Soft deprecate <soft deprecated>` :func:`os.popen` and
11401145
:func:`os.spawn* <os.spawnl>` functions. They should no longer be used to

Lib/nturl2path.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
"""
66
# Testing is done through test_nturl2path.
77

8+
import warnings
9+
10+
11+
warnings._deprecated(__name__, remove=(3, 19))
12+
813
def url2pathname(url):
914
"""OS-specific conversion from a relative URL of the 'file' scheme
1015
to a file system path; not recommended for general use."""

Lib/test/test_nturl2path.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
import nturl2path
21
import unittest
32

3+
from test.support import warnings_helper
4+
5+
nturl2path = warnings_helper.import_deprecated("nturl2path")
6+
7+
48

59
class NTURL2PathTest(unittest.TestCase):
610
"""Test pathname2url() and url2pathname()"""
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Deprecate the :mod:`!nturl2path` module. Call
2+
:func:`urllib.request.url2pathname` and :func:`~urllib.request.pathname2url`
3+
instead.

0 commit comments

Comments
 (0)