summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2015-05-16 20:24:28 +0300
committerBerker Peksag <berker.peksag@gmail.com>2015-05-16 20:24:28 +0300
commit6c716b13153b79d291e3c3882c45e12f168ebbd5 (patch)
treefd31462b5a31c4dbee94734618f88d8f1d87d8d1
parent4f3abf4912e2f9b8f50f74b943257f0f43bbe780 (diff)
downloadcpython-6c716b13153b79d291e3c3882c45e12f168ebbd5.tar.gz
Issue #24210: Silence a PendingDeprecationWarning warning in platform.platform().
-rwxr-xr-xLib/platform.py12
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',