summaryrefslogtreecommitdiffstats
path: root/Lib/platform.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2020-05-09 14:12:41 (GMT)
committerGitHub <noreply@github.com>2020-05-09 14:12:41 (GMT)
commit2c3d508c5fabe40dac848fb9ae558069f0576879 (patch)
treea0075079dfef0b4f68bc1492a6ef6d0d9b3b916f /Lib/platform.py
parent77c614624b6bf2145bef69830d0f499d8b55ec0c (diff)
downloadcpython-2c3d508c5fabe40dac848fb9ae558069f0576879.zip
cpython-2c3d508c5fabe40dac848fb9ae558069f0576879.tar.gz
cpython-2c3d508c5fabe40dac848fb9ae558069f0576879.tar.bz2
bpo-40570: Improve compatibility of uname_result with late-bound .platform (#20015)
* bpo-40570: Improve compatibility of uname_result with late-bound .platform. * Add test capturing ability to cast uname to a tuple.
Diffstat (limited to 'Lib/platform.py')
-rwxr-xr-xLib/platform.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/platform.py b/Lib/platform.py
index 049c2c6..e9f50ab 100755
--- a/Lib/platform.py
+++ b/Lib/platform.py
@@ -798,9 +798,10 @@ class uname_result(
)
def __getitem__(self, key):
- if key == 5:
- return self.processor
- return super().__getitem__(key)
+ return tuple(iter(self))[key]
+
+ def __len__(self):
+ return len(tuple(iter(self)))
_uname_cache = None