[compat] Replace deficient ChainMap class in Py3.3 and earlier
authordirkf <fieldhouse@gmx.net>
Fri, 26 Aug 2022 09:17:56 +0000 (10:17 +0100)
committerdirkf <fieldhouse@gmx.net>
Fri, 26 Aug 2022 09:24:42 +0000 (10:24 +0100)
youtube_dl/compat.py

index 3002109ca526121e8967a0326537710a85a2ea13..366a93924a8ab4786929ded0d0aef591af91ec88 100644 (file)
@@ -3004,8 +3004,11 @@ except ImportError:
 # new class in collections
 try:
     from collections import ChainMap as compat_collections_chain_map
+    # Py3.3's ChainMap is deficient
+    if sys.version_info <= (3, 3):
+        raise ImportError
 except ImportError:
-    # Py < 3.3
+    # Py <= 3.3
     class compat_collections_chain_map(compat_collections_abc.MutableMapping):
 
         maps = [{}]
@@ -3060,6 +3063,7 @@ except ImportError:
         def parents(self):
             return compat_collections_chain_map(*(self.maps[1:]))
 
+
 # Pythons disagree on the type of a pattern (RegexObject, _sre.SRE_Pattern, Pattern, ...?)
 compat_re_Pattern = type(re.compile(''))