浏览代码

[compat] Fix inheriting from compat_collections_chain_map
* see ytdl-org/youtube-dl#33079#issuecomment-2704038049

dirkf 5 月之前
父节点
当前提交
974c7d7f34
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      youtube_dl/compat.py

+ 3 - 2
youtube_dl/compat.py

@@ -3473,11 +3473,12 @@ except ImportError:
         def new_child(self, m=None, **kwargs):
         def new_child(self, m=None, **kwargs):
             m = m or {}
             m = m or {}
             m.update(kwargs)
             m.update(kwargs)
-            return compat_collections_chain_map(m, *self.maps)
+            # support inheritance !
+            return type(self)(m, *self.maps)
 
 
         @property
         @property
         def parents(self):
         def parents(self):
-            return compat_collections_chain_map(*(self.maps[1:]))
+            return type(self)(*(self.maps[1:]))
 
 
 
 
 # compat_re_Pattern, compat_re_Match
 # compat_re_Pattern, compat_re_Match