chiark
/
gitweb
/
~ian
/
secnet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9d9a15d
)
make-secnet-sites: Apply list() to keys in delempty
author
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Thu, 24 Oct 2019 16:18:37 +0000
(17:18 +0100)
committer
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Thu, 24 Oct 2019 18:16:16 +0000
(19:16 +0100)
It is not permitted (in Python3) to modify a dictionary like this,
while iterating over keys(). We have to make a list of the keys,
copying them.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
make-secnet-sites
patch
|
blob
|
history
diff --git
a/make-secnet-sites
b/make-secnet-sites
index 76d74f1a6907944b1cb5b3b2d5e2be31e1c54fae..1cc979b57e4c5c7ecb66ffcbee9edf19154541cd 100755
(executable)
--- a/
make-secnet-sites
+++ b/
make-secnet-sites
@@
-527,7
+527,7
@@
def live(n):
return 0
def delempty(n):
"Delete nodes that have no leafnode children"
- for i in
n.children.keys(
):
+ for i in
list(n.children.keys()
):
delempty(n.children[i])
if not live(n.children[i]):
del n.children[i]