Kaydet (Commit) f4fdb619 authored tarafından Miss Islington (bot)'s avatar Miss Islington (bot) Kaydeden (comit) Petr Viktorin

bpo-28167: bump platform.linux_distribution removal to 3.8 (GH-6669) (GH-6862)

Also bump PendingDeprecationWarning to DeprecationWarning.
(cherry picked from commit 9eb40bc3)
Co-authored-by: 's avatarMatthias Bussonnier <bussonniermatthias@gmail.com>
üst 6bd0c476
...@@ -248,7 +248,8 @@ Unix Platforms ...@@ -248,7 +248,8 @@ Unix Platforms
This is another name for :func:`linux_distribution`. This is another name for :func:`linux_distribution`.
.. deprecated-removed:: 3.5 3.7 .. deprecated-removed:: 3.5 3.8
See alternative like the `distro <https://pypi.org/project/distro>`_ package.
.. function:: linux_distribution(distname='', version='', id='', supported_dists=('SuSE','debian','redhat','mandrake',...), full_distribution_name=1) .. function:: linux_distribution(distname='', version='', id='', supported_dists=('SuSE','debian','redhat','mandrake',...), full_distribution_name=1)
...@@ -266,7 +267,8 @@ Unix Platforms ...@@ -266,7 +267,8 @@ Unix Platforms
parameters. ``id`` is the item in parentheses after the version number. It parameters. ``id`` is the item in parentheses after the version number. It
is usually the version codename. is usually the version codename.
.. deprecated-removed:: 3.5 3.7 .. deprecated-removed:: 3.5 3.8
See alternative like the `distro <https://pypi.org/project/distro>`_ package.
.. function:: libc_ver(executable=sys.executable, lib='', version='', chunksize=2048) .. function:: libc_ver(executable=sys.executable, lib='', version='', chunksize=2048)
......
...@@ -302,7 +302,7 @@ def linux_distribution(distname='', version='', id='', ...@@ -302,7 +302,7 @@ def linux_distribution(distname='', version='', id='',
full_distribution_name=1): full_distribution_name=1):
import warnings import warnings
warnings.warn("dist() and linux_distribution() functions are deprecated " warnings.warn("dist() and linux_distribution() functions are deprecated "
"in Python 3.5", PendingDeprecationWarning, stacklevel=2) "in Python 3.5", DeprecationWarning, stacklevel=2)
return _linux_distribution(distname, version, id, supported_dists, return _linux_distribution(distname, version, id, supported_dists,
full_distribution_name) full_distribution_name)
...@@ -376,7 +376,7 @@ def dist(distname='', version='', id='', ...@@ -376,7 +376,7 @@ def dist(distname='', version='', id='',
""" """
import warnings import warnings
warnings.warn("dist() and linux_distribution() functions are deprecated " warnings.warn("dist() and linux_distribution() functions are deprecated "
"in Python 3.5", PendingDeprecationWarning, stacklevel=2) "in Python 3.5", DeprecationWarning, stacklevel=2)
return _linux_distribution(distname, version, id, return _linux_distribution(distname, version, id,
supported_dists=supported_dists, supported_dists=supported_dists,
full_distribution_name=0) full_distribution_name=0)
...@@ -1345,7 +1345,7 @@ def platform(aliased=0, terse=0): ...@@ -1345,7 +1345,7 @@ def platform(aliased=0, terse=0):
'ignore', 'ignore',
r'dist\(\) and linux_distribution\(\) ' r'dist\(\) and linux_distribution\(\) '
'functions are deprecated .*', 'functions are deprecated .*',
PendingDeprecationWarning, DeprecationWarning,
) )
distname, distversion, distid = dist('') distname, distversion, distid = dist('')
if distname and not terse: if distname and not terse:
......
...@@ -353,14 +353,14 @@ class PlatformTest(unittest.TestCase): ...@@ -353,14 +353,14 @@ class PlatformTest(unittest.TestCase):
class DeprecationTest(unittest.TestCase): class DeprecationTest(unittest.TestCase):
def test_dist_deprecation(self): def test_dist_deprecation(self):
with self.assertWarns(PendingDeprecationWarning) as cm: with self.assertWarns(DeprecationWarning) as cm:
platform.dist() platform.dist()
self.assertEqual(str(cm.warning), self.assertEqual(str(cm.warning),
'dist() and linux_distribution() functions are ' 'dist() and linux_distribution() functions are '
'deprecated in Python 3.5') 'deprecated in Python 3.5')
def test_linux_distribution_deprecation(self): def test_linux_distribution_deprecation(self):
with self.assertWarns(PendingDeprecationWarning) as cm: with self.assertWarns(DeprecationWarning) as cm:
platform.linux_distribution() platform.linux_distribution()
self.assertEqual(str(cm.warning), self.assertEqual(str(cm.warning),
'dist() and linux_distribution() functions are ' 'dist() and linux_distribution() functions are '
......
The function ``platform.linux_ditribution`` and ``platform.dist`` now
trigger a ``DeprecationWarning`` and have been marked for removal in Python
3.8
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment