about summary refs log tree commit diff
diff options
context:
space:
mode:
authordirkf <fieldhouse@gmx.net>2022-08-26 10:17:56 +0100
committerdirkf <fieldhouse@gmx.net>2022-08-26 10:24:42 +0100
commit0f6422590e44e99e9b81cf2367666efe89fae3aa (patch)
treee92c97ae8fdb08080de1ea2447eb3ede22da3434
parent4c6fba37650d60acbd32a9f2d6e2468a730d0f1c (diff)
downloadyoutube-dl-0f6422590e44e99e9b81cf2367666efe89fae3aa.tar.gz
youtube-dl-0f6422590e44e99e9b81cf2367666efe89fae3aa.tar.xz
youtube-dl-0f6422590e44e99e9b81cf2367666efe89fae3aa.zip
[compat] Replace deficient ChainMap class in Py3.3 and earlier
-rw-r--r--youtube_dl/compat.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/youtube_dl/compat.py b/youtube_dl/compat.py
index 3002109ca..366a93924 100644
--- a/youtube_dl/compat.py
+++ b/youtube_dl/compat.py
@@ -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(''))