1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-10-27 04:55:04 +03:00
Commit Graph

386 Commits

Author SHA1 Message Date
Victor Stinner
f42a0524c6 Build the Python extension with PY_SSIZE_T_CLEAN
The Python extension module now uses Py_ssize_t rather than int for
string lengths. This change makes the extension compatible with
Python 3.10.

Fixes #203.
2020-11-19 18:09:22 +01:00
Miro Hrončok
e4fb368418 Parenthesize Py<type>_Check() in ifs
In C, if expressions should be parenthesized.
PyLong_Check, PyUnicode_Check etc. happened to expand to a parenthesized
expression before, but that's not API to rely on.

Since Python 3.9.0a4 it needs to be parenthesized explicitly.

Fixes https://gitlab.gnome.org/GNOME/libxml2/issues/149
2020-03-10 14:21:27 +01:00
Nick Wellnhofer
20c60886e4 Fix typos
Resolves #133.
2020-03-08 17:41:53 +01:00
Pieter van Oostrum
8f62ac92b2 Updated Python test reader2.py
Added all test cases that have a non-empty error in result/valid/*.xml.err
Restructured to make it easier extensible with new test cases
Added coding cookie because there is non-ASCII in the error messages
2020-01-02 13:50:10 +01:00
Pieter van Oostrum
8c3e52ebd9 Updated python/tests/tstLastError.py
libxml2.registerErrorHandler(None,None):
None is not acceptable as first argument
failUnlessEqual replaced by assertEqual
2020-01-02 13:49:31 +01:00
Nick Wellnhofer
d188eb921a Make sure that Python tests exit with error code
Closes #108.
2019-10-21 12:45:37 +02:00
Jared Yanovich
2a350ee9b4 Large batch of typo fixes
Closes #109.
2019-09-30 18:04:38 +02:00
Nick Wellnhofer
9d461ac7d0 Adjust expected error in Python tests
Closes #107.
2019-09-26 16:17:31 +02:00
Nick Wellnhofer
7f40ed01f7 Fix Python bindings under Windows
- Correct linker flags for MinGW-w64
- Adjust PATH to find libxml2.dll when running tests
2019-01-06 14:32:28 +01:00
Patrick Welche
d910e99c32 python: remove single use of _PyVerify_fd
_PyVerify_fd disappeared from python with:

  https://hg.python.org/cpython/rev/e88e2049b793

https://bugzilla.gnome.org/show_bug.cgi?id=776815
2018-03-05 16:29:58 +01:00
Nick Wellnhofer
0c91391683 Remove generated file python/setup.py from version control 2017-10-07 15:22:57 +02:00
Daniel Veillard
4b4d3d8516 Release of libxml2-2.9.6
* configure.ac doc/xml.html doc/news.html: updated for release
2017-10-06 09:00:53 +02:00
Daniel Veillard
2960178fe8 Release of libxml2-2.9.5
* configure.ac, doc/xslt.html: updated for the release
* doc/*, python/setup.py, testapi.c: regenerated
2017-09-04 15:38:47 +02:00
Patrick Monnerat
d1f9062486 small changes for OS/400
OS/400 version V5R3 is not supported by IBM anymore.
In addition, the iSeries system I have here for development has been changed
and the new system is not able to compile for an OS version lower than V6R1.

Thus I made some updates to the libxml2 os400 scripts accordingly:

- Oldest supported OS version is now V6R1.
- Adjust ILE/RPG wrappers comments.
- Update copyright year range.
- Do not log compiler informational messages.
2017-07-27 11:20:02 +08:00
Nick Wellnhofer
83212ff4be Fix expected error output in Python tests 2017-06-01 14:31:28 +02:00
Daniel Veillard
8effcb578e Fix apibuild for a recently added construct
commit c71f9305a9 added __XML_EXTERNC
cpp construct which not understood by apibuild, leading to make dist
failures, ask to ignore that construct.
2016-05-09 10:31:09 +08:00
Jan Pokorný
bb654feb9a Fix typos: dictio{ nn -> n }ar{y,ies}
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
2016-04-15 22:22:48 +08:00
Michael Stahl
65112cb36a python 3: libxml2.c wrappers create Unicode str already
... so stop decoding these, which only results in
"TypeError: 'str' does not support the buffer interface".
2016-03-11 16:18:13 +08:00
Daniel Veillard
6657afe83a Release of libxml2-2.9.3
* configure.ac: updated
* doc/*: regenerated
2015-11-20 17:55:11 +08:00
Daniel Veillard
726f67e2f1 Release of libxml2-2.9.2 2014-10-16 15:40:16 +08:00
Roumen Petrov
c2450d8ba3 fix some tabs mixing incompatible with python3 2014-10-16 11:46:35 +08:00
Daniel Veillard
af62eb4fab Python generator bug raised by the const change
the doc methode for xmlDocGetRootElement wasn't generated anymore
2014-10-13 16:40:56 +08:00
John Beck
6bea543eca python/tests/sync.py assumes Python dictionaries are ordered
For https://bugzilla.gnome.org/show_bug.cgi?id=734017

Solaris has had libxml2 version 2.9.1 for a while, with Python versions 2.6 and
2.7.  While preparing to also build a module for Python 3.4, we ran into an
issue with the test case sync.py failing. The failure involved parsing a
string that included a Python dictionary, then complaining when the order of
the parsed result did not match the original order.  But Python dictionaries
are unordered by definition; see section 5.5 of
https://docs.python.org/2/tutorial/datastructures.html .  For whatever reason,
Python 2.6 and 2.7 always happened to report the pair of values back in their
original order, but with Python 3.4 the order is random.  The attached patch
allows for either order; it also fixes a typo that was repeated several times
thanks to the magic of copy & paste.
2014-10-06 18:26:27 +08:00
Ron Angeles
b3e488b0d9 Add methods for python3 iterator
xmlCoreDepthFirstItertor and xmlCoreBreadthFirstItertr only
implement a python2-compatible iterator interface. The next()
method has been changed to __next__(). An alias has been
defined to keep python2 compatibility.
2014-10-03 17:01:24 +08:00
Daniel Veillard
4b61cf61e7 fix some tabs mixing incompatible with python3
Patrick Welche <prlw1@cam.ac.uk> raised this issue
2013-10-02 22:18:21 +08:00
Arfrever Frehtes Taifersar Arahesis
6dd7775f35 Another round of fixes for older versions of Python 2013-07-12 11:18:11 +08:00
Alexandre Rostovtsev
6c9c611bee python: fix drv_libxml2.py for python3 compatibility
https://bugzilla.gnome.org/show_bug.cgi?id=703979
2013-07-11 15:16:02 +08:00
Armin K
6eea2f2c60 python: Fix compiler warnings when building python3 bindings 2013-06-03 22:03:28 +02:00
Petr Sumbera
722923bc9b Fix for compilation with python 2.6.8
Remap PyCapsule to PyCObject based on the macro being available
instead of using the python version
2013-05-03 22:25:38 +08:00
dcb
10ec19ab0a Fix missing break on last() function for attributes
pointed out by cppcheck
2013-05-02 16:11:46 +08:00
Daniel Veillard
f4e5a6994e Release of libxml2-2.9.1
* configure.in: bumped version
* doc/*: updated the symbols file and regenerated
2013-04-19 15:36:36 +08:00
Daniel Veillard
c0a8dd14f8 Fix a linking error for python bindings
Showing up apparently in Debian BTS distro
https://bugzilla.gnome.org/show_bug.cgi?id=685515
2013-04-19 15:02:33 +08:00
Daniel Veillard
bf4a8f0ea8 Fix python bindings with versions older than 2.7
Need fixing on the Capsule usage, the lack of PyBytes,
lack of io module and the way to access exception details.
2013-04-02 10:27:57 +08:00
Daniel Veillard
87f3287d9b Fix tree iterators broken by 2to3 script 2013-04-01 13:33:42 +08:00
Daniel Veillard
2cb6bf8eb0 update all tests for Python3 and Python2 2013-03-30 22:33:06 +08:00
Daniel Veillard
6f18465189 A few more fixes for python 3 affecting libxml2.py
need a few changes to the generator and the libxml.py stub
2013-03-30 22:33:06 +08:00
Daniel Veillard
3798c4adbb 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
2013-03-30 22:33:06 +08:00
Daniel Veillard
3cb1ae26ec First pass at starting porting to python3 2013-03-30 22:33:06 +08:00
Daniel Veillard
a5e513a552 Fix a uneeded and wrong extra link parameter 2013-03-30 22:33:06 +08:00
Shaun McCance
519bc6a3ab Add support for xpathRegisterVariable in Python 2013-03-27 15:55:36 +08:00
Alexey Neyman
d749528aa9 Silent the new python test on input
Just make it silent if there is no error
2013-02-27 13:11:47 +08:00
Alexey Neyman
a9016c4927 Fix a few problems with setEntityLoader
1. Setting entity loader does not increment the refcount on the Python object
passed in. This works only if the object is not deleted. For example, the
following code results in segmentation fault in Python interpreter when
attempting to process any document:

[[[
def register_entity_loader():
    def entity_loader(URL, ID, ctxt):
        ...
    libxml2.setEntityLoader(entity_loader

register_entity_loader()
]]]

2. setEntityLoader() does not verify if the passed object is callable. If it
is not, current implementation attempts to call it anyway and failing that,
silently moves on to default entity loader. Attached patch makes
setEntityLoader raise ValueError exception if non-callable object is
passed.

3. In debug mode, pythonExternalEntityLoader() outputs the result object to
stderr, while the messages before and after the object (description + newline)
go to stdout. Attached patch makes them all go to stdout.
2013-02-25 16:07:09 +08:00
Alexey Neyman
48da90bc4a Python binding for xmlRegisterInputCallback
It is possible to make xmlIO handle any protocol by means of
xmlRegisterInputCallback(). However, that function is currently only
available in C API. So, the natural solution seems to be implementing Python
bindings for the xmlRegisterInputCallback.

* python/generator.py: skip xmlPopInputCallbacks
* python/libxml.c python/libxml.py python/libxml_wrap.h: implement the
  wrappers
* python/tests/input_callback.py python/tests/Makefile.am: also add a test case
2013-02-25 15:54:25 +08:00
Alexey Neyman
e32ceb93f4 Python bindings: DOM casts everything to xmlNode
I noticed another issue with Python bindings of libxml: the access methods do
not cast the pointers to specific classes such as xmlDtd, xmlEntityDecl, etc.
For example, with the following document:

<?xml version="1.0"?>
<!DOCTYPE root [<!ELEMENT root EMPTY>]>
<root/>

the following script:

import libxml2
doc = libxml2.readFile("c.xml", None, libxml2.XML_PARSE_DTDLOAD)
print repr(doc.children)

prints:

<xmlNode (root) object at 0xb74963ec>

With properly cast nodes, it outputs the following:

<xmlDtd (root) object at 0xb746352c>

The latter object (xmlDtd) enables one to use DTD-specific methods such as
debugDumpDTD(), copyDTD(), and so on.
2013-02-21 16:00:03 +08:00
Daniel Veillard
f8e3db0445 Big space and tab cleanup
Remove all space before tabs and space and tabs at end of lines.
2012-09-11 13:26:36 +08:00
Csaba Raduly
429d3a0aae Allow to set the quoting character of an xmlWriter
It's otherwise impossible to set the quoting character of
attribute values of an xmlWriter.
2012-09-11 11:52:46 +08:00
Daniel Veillard
857104cd49 Remove all .cvsignore as they are not used anymore
For https://bugzilla.gnome.org/show_bug.cgi?id=682985
suggested by Adrian Bunk <bunk@stusta.de>
2012-09-04 14:25:23 +08:00
Akira TAGOH
961b535c10 Bug 676544 - fails to build with --without-sax1
Added some ifdef'd LIBXML_SAX1_ENABLED to make it buildable with
--without-sax1 configure option.
2012-08-28 22:03:16 +08:00
Daniel Richard G
d10a72ce8c Bundles all generated files for python into the distribution
So end users building the Python module don't need to
regenerate any source files. some clean-up too.
2012-08-14 12:50:25 +08:00
Roumen Petrov
c3b1d09ba2 clean redefinition of {v}snprintf in C-source
as those from *config.h are preferable (e.g. win32config.h)
2012-08-13 16:57:30 +08:00