summaryrefslogtreecommitdiff
path: root/python/libxml_wrap.h
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2014-09-02 13:34:01 +0400
committerIgor Pashev <pashev.igor@gmail.com>2014-09-02 13:34:01 +0400
commitfa06cf6edf86aa1839d4f43bfd3bd9a3a36b5223 (patch)
tree705466443ec58fffa74a3499a3bcc56be1cdee9d /python/libxml_wrap.h
parent08f466c86ef859f2f3ab1f65677536cbccd85960 (diff)
parent3a8c2d58eab0410fe5e79a112614aa9be061dc46 (diff)
downloadlibxml2-fa06cf6edf86aa1839d4f43bfd3bd9a3a36b5223.tar.gz
Merge branch 'master' of git://anonscm.debian.org/debian-xml-sgml/libxml2
Conflicts: debian/changelog debian/control debian/rules
Diffstat (limited to 'python/libxml_wrap.h')
-rw-r--r--python/libxml_wrap.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/python/libxml_wrap.h b/python/libxml_wrap.h
index eaa5e96..a9b9739 100644
--- a/python/libxml_wrap.h
+++ b/python/libxml_wrap.h
@@ -23,6 +23,25 @@
#include <libxml/xmlschemas.h>
#endif
+/*
+ * for older versions of Python, we don't use PyBytes, but keep PyString
+ * and don't use Capsule but CObjects
+ */
+#if PY_VERSION_HEX < 0x02070000
+#ifndef PyBytes_Check
+#define PyBytes_Check PyString_Check
+#define PyBytes_Size PyString_Size
+#define PyBytes_AsString PyString_AsString
+#define PyBytes_AS_STRING PyString_AS_STRING
+#define PyBytes_GET_SIZE PyString_GET_SIZE
+
+#define PyCapsule_New PyCObject_FromVoidPtrAndDesc
+#define PyCapsule_CheckExact PyCObject_Check
+#define PyCapsule_GetPointer(o, n) PyCObject_GetDesc((o))
+
+#endif
+#endif
+
/**
* ATTRIBUTE_UNUSED:
*
@@ -150,8 +169,16 @@ typedef struct {
} PyURI_Object;
/* FILE * have their own internal representation */
+#if PY_MAJOR_VERSION >= 3
+FILE *libxml_PyFileGet(PyObject *f);
+void libxml_PyFileRelease(FILE *f);
+#define PyFile_Get(v) (((v) == Py_None) ? NULL : libxml_PyFileGet(v))
+#define PyFile_Release(f) libxml_PyFileRelease(f)
+#else
#define PyFile_Get(v) (((v) == Py_None) ? NULL : \
(PyFile_Check(v) ? (PyFile_AsFile(v)) : stdout))
+#define PyFile_Release(f)
+#endif
#ifdef LIBXML_SCHEMAS_ENABLED
typedef struct {
@@ -247,3 +274,6 @@ PyObject * libxml_xmlSchemaValidCtxtPtrWrap(xmlSchemaValidCtxtPtr valid);
#endif /* LIBXML_SCHEMAS_ENABLED */
PyObject * libxml_xmlErrorPtrWrap(xmlErrorPtr error);
PyObject * libxml_xmlSchemaSetValidErrors(PyObject * self, PyObject * args);
+PyObject * libxml_xmlRegisterInputCallback(PyObject *self, PyObject *args);
+PyObject * libxml_xmlUnregisterInputCallback(PyObject *self, PyObject *args);
+PyObject * libxml_xmlNodeRemoveNsDef(PyObject * self, PyObject * args);