From bc1d76ae5fbb550924d63ec2655759d1eb130ca3 Mon Sep 17 00:00:00 2001 From: Jason Hobbs Date: Thu, 8 Oct 2020 06:06:05 -0500 Subject: [PATCH] Iterate over a copy of items in ActionAPI.__call__. (#247) This fixes issue #246. Previously, this buggy code in python 3, due to it modifying keys of a dictionary being iterated over. --- maas/client/bones/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maas/client/bones/__init__.py b/maas/client/bones/__init__.py index 92ce5ad6..28f26cfc 100644 --- a/maas/client/bones/__init__.py +++ b/maas/client/bones/__init__.py @@ -301,7 +301,7 @@ async def __call__(self, **data): del data[key] for nested_key, nested_value in value.items(): data[key + "_" + nested_key] = nested_value - for key, value in data.items(): + for key, value in data.copy().items(): if key.startswith("_"): data[key[1:]] = data.pop(key) response = await self.bind(**params).call(**data)