summaryrefslogtreecommitdiff
path: root/ext/_yaml.h
diff options
context:
space:
mode:
authorxi <xi@18f92427-320e-0410-9341-c67f048884a3>2008-12-30 13:30:52 +0000
committerxi <xi@18f92427-320e-0410-9341-c67f048884a3>2008-12-30 13:30:52 +0000
commit1ade43b5ac1f866ace28edd4c3a5dddfbf4e01eb (patch)
tree2c7d16dcf701bfb0a4a1e14d4eb67d8c4c4742ec /ext/_yaml.h
parent5786709db70a02fb5d2ab88d70262f20015be0b4 (diff)
downloadpyyaml-1ade43b5ac1f866ace28edd4c3a5dddfbf4e01eb.tar.gz
Fixed str/bytes issues with Python 3 in _yaml.pyx.
git-svn-id: http://svn.pyyaml.org/pyyaml/trunk@334 18f92427-320e-0410-9341-c67f048884a3
Diffstat (limited to 'ext/_yaml.h')
-rw-r--r--ext/_yaml.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/ext/_yaml.h b/ext/_yaml.h
index b39292d..3583e01 100644
--- a/ext/_yaml.h
+++ b/ext/_yaml.h
@@ -1,7 +1,11 @@
#include <yaml.h>
-#if PY_MAJOR_VERSION >= 3
+#if PY_MAJOR_VERSION < 3
+
+#define PyUnicode_FromString(s) PyUnicode_DecodeUTF8((s), strlen(s), 'strict')
+
+#else
#define PyString_CheckExact PyBytes_CheckExact
#define PyString_AS_STRING PyBytes_AS_STRING