From 2c3d508c5fabe40dac848fb9ae558069f0576879 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 9 May 2020 10:12:41 -0400 Subject: 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. --- Lib/platform.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'Lib/platform.py') diff --git a/Lib/platform.py b/Lib/platform.py index 049c2c6ef2..e9f50ab622 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 -- cgit v1.2.1