From 28b69e06e5de8b37fe691df43e4ae7e731eae29f Mon Sep 17 00:00:00 2001 From: Taapat Date: Sun, 7 May 2023 13:32:26 +0300 Subject: [PATCH] Fix compat_map force-test --- src/compat.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/compat.py b/src/compat.py index 82a8ef6e..94fefe98 100644 --- a/src/compat.py +++ b/src/compat.py @@ -38,6 +38,7 @@ from collections import ChainMap as compat_map else: from collections import MutableMapping + from itertools import chain class compat_map(MutableMapping): maps = [{}] @@ -68,11 +69,16 @@ def __delitem__(self, k): self.__delitem(k) def __iter__(self): - return itertools.chain(*reversed(self.maps)) + return chain(*reversed(self.maps)) def __len__(self): return len(iter(self)) + def new_child(self, m=None, **kwargs): + m = m or {} + m.update(kwargs) + return compat_map(m, *self.maps) + SUBURI = '&suburi='