Source

pyyaml / tests / lib / test_input_output.py

Diff from to

tests/lib/test_input_output.py

 
 def _unicode_open(file, encoding, errors='strict'):
     info = codecs.lookup(encoding)
-    srw = codecs.StreamReaderWriter(file, info.streamreader, info.streamwriter, errors)
+    if isinstance(info, tuple):
+        reader = info[2]
+        writer = info[3]
+    else:
+        reader = info.streamreader
+        writer = info.streamwriter
+    srw = codecs.StreamReaderWriter(file, reader, writer, errors)
     srw.encoding = encoding
     return srw