summaryrefslogtreecommitdiff
path: root/sys-libs/libsmbios/files/libsmbios-2.4.3-python-deprecations.patch
blob: c67df620e85fe033d9d53e923c40ad555eb3e294 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
From 99e0ac359d55d7a66d944e038ad63a7f6ef6698d Mon Sep 17 00:00:00 2001
From: troy <70726977+troygraben@users.noreply.github.com>
Date: Mon, 26 Jul 2021 17:05:35 -0400
Subject: [PATCH] Fix the TokenTable generator implementation

This change supports PEP 479 by changing the generator to use return
instead of raising StopIteration.

This fixes the RuntimeError exception being raised with Python 3.7 and
newer when the iterator reaches the end of the collection. This could be
encountered when calling smbios-token-ctl --dump-tokens
--- a/src/bin/smbios-token-ctl
+++ b/src/bin/smbios-token-ctl
@@ -427,8 +427,6 @@ def main():
         verboseLog.info( _("The token library returned this error:") )
         verboseLog.info( str(e) )
         moduleLog.info( cli.standardFailMessage )
-    except StopIteration:
-        pass
 
     return exit_code
 
--- a/src/python/libsmbios_c/smbios_token.py
+++ b/src/python/libsmbios_c/smbios_token.py
@@ -131,7 +131,7 @@ def __iter__(self):
             if bool(cur):
                 yield cur.contents
             else:
-                raise StopIteration
+                return
 
     @traceLog()
     def __getitem__(self, id):