mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
#10777: fix iteration over dict keys while mutating the dict.
This commit is contained in:
parent
ff52f76019
commit
90b20675bd
3 changed files with 13 additions and 1 deletions
|
@ -1068,7 +1068,7 @@ _serialize = {
|
|||
def register_namespace(prefix, uri):
|
||||
if re.match("ns\d+$", prefix):
|
||||
raise ValueError("Prefix format reserved for internal use")
|
||||
for k, v in _namespace_map.items():
|
||||
for k, v in list(_namespace_map.items()):
|
||||
if k == uri or v == prefix:
|
||||
del _namespace_map[k]
|
||||
_namespace_map[uri] = prefix
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue