summaryrefslogtreecommitdiff
path: root/ext/_yaml.h
diff options
context:
space:
mode:
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