diff options
author | Berker Peksag <berker.peksag@gmail.com> | 2015-05-16 20:24:28 +0300 |
---|---|---|
committer | Berker Peksag <berker.peksag@gmail.com> | 2015-05-16 20:24:28 +0300 |
commit | 6c716b13153b79d291e3c3882c45e12f168ebbd5 (patch) | |
tree | fd31462b5a31c4dbee94734618f88d8f1d87d8d1 | |
parent | 4f3abf4912e2f9b8f50f74b943257f0f43bbe780 (diff) | |
download | cpython-6c716b13153b79d291e3c3882c45e12f168ebbd5.tar.gz |
Issue #24210: Silence a PendingDeprecationWarning warning in platform.platform().
-rwxr-xr-x | Lib/platform.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Lib/platform.py b/Lib/platform.py index 52a009a369..6345184902 100755 --- a/Lib/platform.py +++ b/Lib/platform.py @@ -114,6 +114,8 @@ __version__ = '1.0.7' import collections import sys, os, re, subprocess +import warnings + ### Globals & Constants # Determine the platform's /dev/null device @@ -1438,7 +1440,15 @@ def platform(aliased=0, terse=0): elif system in ('Linux',): # Linux based systems - distname, distversion, distid = dist('') + with warnings.catch_warnings(): + # see issue #1322 for more information + warnings.filterwarnings( + 'ignore', + 'dist\(\) and linux_distribution\(\) ' + 'functions are deprecated .*', + PendingDeprecationWarning, + ) + distname, distversion, distid = dist('') if distname and not terse: platform = _platform(system, release, machine, processor, 'with', |