From 702e044b90fd0a0524fa4574648fe7dae4d4f2fe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
Date: Wed, 22 May 2019 21:31:22 +0200
Subject: [PATCH] Don't change dictionary keys during iteration
With Python 3.8.0a4+, we get the following RuntimeError in Fedora:
PYTHONPATH=../../lib ../bin/dump_keywords.py --template-dir=../templates --output-dir=rst/reference_appendices/ -d ./keyword_desc.yml
Traceback (most recent call last):
File "../bin/dump_keywords.py", line 49, in <module>
for a in oblist[name]:
RuntimeError: dictionary keys changed during iteration
And:
def populate(self):
super(Interfaces, self).populate()
self.facts['all_ipv4_addresses'] = list()
self.facts['all_ipv6_addresses'] = list()
data = self.responses[0]
interfaces = self.parse_interfaces(data)
> for key in interfaces.keys():
E RuntimeError: dictionary keys changed during iteration
In TestDellos9Facts.test_dellos9_facts_gather_subset_default
and TestDellos9Facts.test_dellos9_facts_gather_subset_interfaces.
Python change: https://github.com/python/cpython/pull/12596
Downstream bug: https://bugzilla.redhat.com/show_bug.cgi?id=1712531
---
docs/bin/dump_keywords.py | 2 +-
lib/ansible/modules/network/dellos9/dellos9_facts.py | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/docs/bin/dump_keywords.py b/docs/bin/dump_keywords.py
index 30056a6fc8cc..e25171126576 100755
--- a/docs/bin/dump_keywords.py
+++ b/docs/bin/dump_keywords.py
@@ -46,7 +46,7 @@
oblist[name] = dict((x, aobj.__dict__['_attributes'][x]) for x in aobj.__dict__['_attributes'] if 'private' not in x or not x.private)
# pick up docs if they exist
- for a in oblist[name]:
+ for a in list(oblist[name]):
if a in docs:
oblist[name][a] = docs[a]
else: