Commits

Kirill Simonov committed 6c78d3a

Minor compatibility fixes.

Comments (0)

Files changed (3)

 
 #if PY_MAJOR_VERSION < 3
 
-#define PyUnicode_FromString(s) PyUnicode_DecodeUTF8((s), strlen(s), 'strict')
+#define PyUnicode_FromString(s) PyUnicode_DecodeUTF8((s), strlen(s), "strict")
 
 #else
 
 #library_dirs=../../../libyaml/tags/0.1.2/win32/vs2008/output/release/lib
 #define=YAML_DECLARE_STATIC
 
+# The following options are used to build PyYAML Windows installer
+# for Python 3.0 on my PC:
+#include_dirs=../../../libyaml/tags/0.1.2/include
+#library_dirs=../../../libyaml/tags/0.1.2/win32/vs2008/output/release/lib
+#define=YAML_DECLARE_STATIC

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