summaryrefslogtreecommitdiff
path: root/python/libxml_wrap.h
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@redhat.com>2013-03-29 13:46:24 +0800
committerDaniel Veillard <veillard@redhat.com>2013-03-30 22:33:06 +0800
commit3798c4adbb91f80bef1e9f1b4b61dae72577a244 (patch)
treec50f98b148962a5bd08ff4250924ce2f5719aa43 /python/libxml_wrap.h
parentd8a75bffa4dc8e0e3d31c2f87f0f80212f19393c (diff)
downloadlibxml2-3798c4adbb91f80bef1e9f1b4b61dae72577a244.tar.gz
Fix compilation on Python3
while still compiling on recent Python2: - change the handling of files, tweak the generator, get the fd instead of the FILE *, dup it and fdopen based on mode, add a Release function on Python3 and call to flush from the generated python stubs - switch to using Capsules instead of CObjects - fix PyString to PyBytes - fix PyInt to PyLong - tweak the module registration to compile on both versions - drop PyInstance check for passed xmlNodes and instead check attributes presence Daniel
Diffstat (limited to 'python/libxml_wrap.h')
-rw-r--r--python/libxml_wrap.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/python/libxml_wrap.h b/python/libxml_wrap.h
index ac5a6264..70248d76 100644
--- a/python/libxml_wrap.h
+++ b/python/libxml_wrap.h
@@ -150,8 +150,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 {
@@ -249,3 +257,4 @@ 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);