summaryrefslogtreecommitdiff
path: root/src/lxml/includes
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2016-09-03 15:43:12 +0200
committerStefan Behnel <stefan_ml@behnel.de>2016-09-03 15:43:12 +0200
commit572e10843774a5d6300125d89bdc423d53c92971 (patch)
treee71b587ac25c23bad7c8518ab731e0d459639137 /src/lxml/includes
parentf4a118d1e7c05c26cde4ec719a604ee161da21f1 (diff)
downloadpython-lxml-572e10843774a5d6300125d89bdc423d53c92971.tar.gz
replace IS_PYTHON3 C macro with IS_PYTHON2 before it starts looking funny in Python 4.x :)
Diffstat (limited to 'src/lxml/includes')
-rw-r--r--src/lxml/includes/etree_defs.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/lxml/includes/etree_defs.h b/src/lxml/includes/etree_defs.h
index b923378c..f80bd545 100644
--- a/src/lxml/includes/etree_defs.h
+++ b/src/lxml/includes/etree_defs.h
@@ -41,18 +41,20 @@
#endif
#if PY_MAJOR_VERSION >= 3
-# define IS_PYTHON3 1
+# define IS_PYTHON2 0 /* prefer for special casing Python 2.x */
+# define IS_PYTHON3 1 /* avoid */
#else
+# define IS_PYTHON2 1
# define IS_PYTHON3 0
#endif
-#if IS_PYTHON3
-#undef LXML_UNICODE_STRINGS
-#define LXML_UNICODE_STRINGS 1
-#else
+#if IS_PYTHON2
#ifndef LXML_UNICODE_STRINGS
#define LXML_UNICODE_STRINGS 0
#endif
+#else
+#undef LXML_UNICODE_STRINGS
+#define LXML_UNICODE_STRINGS 1
#endif
#if !IS_PYPY
@@ -71,8 +73,8 @@
# define PyFile_AsFile(o) (NULL)
# undef PyByteArray_Check
# define PyByteArray_Check(o) (0)
-#elif IS_PYTHON3
- /* Python 3 doesn't have PyFile_*() anymore */
+#elif !IS_PYTHON2
+ /* Python 3+ doesn't have PyFile_*() anymore */
# define PyFile_AsFile(o) (NULL)
#endif
@@ -87,7 +89,7 @@
# ifndef PyUnicode_FromFormat
# define PyUnicode_FromFormat PyString_FromFormat
# endif
-# if IS_PYTHON3 && !defined(PyBytes_FromFormat)
+# if !IS_PYTHON2 && !defined(PyBytes_FromFormat)
# ifdef PyString_FromFormat
# define PyBytes_FromFormat PyString_FromFormat
# else