1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-12-27 03:21:26 +03:00
Commit Graph

404 Commits

Author SHA1 Message Date
Nick Wellnhofer
40483d0ce2 Deprecate module init and cleanup functions
These functions shouldn't be part of the public API. Most init
functions are only thread-safe when called from xmlInitParser. Global
variables should only be cleaned up by calling xmlCleanupParser.
2022-03-06 15:59:43 +01:00
Nick Wellnhofer
4a8c71eb7c Remove DOCBparser
This code has been broken and deprecated since version 2.6.0, released
in 2003. Because of a bug in commit 961b535c, DOCBparser.c was never
compiled since 2012. I couldn't find a Debian package using any of its
symbols, so it seems safe to remove this module.
2022-03-04 22:56:21 +01:00
Nick Wellnhofer
ebc5009793 Warn when using deprecated functions from Python bindings
This requires Python code to be run with -Wd.
2022-03-01 13:57:16 +01:00
Nick Wellnhofer
5bc5f0762f Fix build with older Python versions
ModuleNotFoundError is only available since Python 3.6. Use the
superclass ImportError instead. Fixes commit 3cc64a89.

Fixes #347.
2022-02-24 18:41:23 +01:00
Nick Wellnhofer
b057239b3f More fixes to --without-valid build
Fix runtest and Python bindings when building --without-valid.

The Python tests still fail. There doesn't seem to be a mechanism to
disable tests depending on feature flags.
2022-02-22 11:52:38 +01:00
Nick Wellnhofer
004fe9de53 Deprecate IDREF-related functions in valid.h
These functions are only needed internally for validation.

xmlGetRefs is inherently unsafe because the ref table isn't updated
if attributes are removed (unlike the ids table).

None of the Ubuntu 20.04 packages depending on libxml2 use any of these
functions (except xmlFreeRefTable in libxslt), so it seems perfectly
safe to deprecate them.

Remove xmlIsRef and xmlRemoveRef from the Python bindings.
2022-02-20 21:49:05 +01:00
Nick Wellnhofer
f2ad86fa60 Remove SVN keyword anchors 2022-02-17 19:05:26 +01:00
Nick Wellnhofer
1089111142 Redirect links to xmlsoft.org
Documentation and releases are now available on gitlab.gnome.org.
2022-02-13 23:10:00 +01:00
Chun-wei Fan
3cc64a88d4 setup.py.in: Try to import setuptools
This way, we can build binary wheels easily if needed
2022-01-16 15:18:06 +01:00
Chun-wei Fan
dbfe6151ff Python distutils: Make DLL packaging more flexible
This updates setup.py.in to pack the DLLs according to the options we specified
to configure.js or CMake (or, even configure, although autotools builds are not
likely to build the libxml2 Python module via distutils).

At this point, we can pack only the DLLs that libxml2 really depends on, and
pack the libxslt DLLs only if we really built the libxslt Python modules.

Also make the DLL filenames more easily configured
2022-01-16 15:18:06 +01:00
Chun-wei Fan
1b7d4e2bcc tstmem.py: Try importing from libxmlmods.libxml2mod if needed
Distutils builds place libxml2mod.pyd under the libxmlmods subdir, so try this
directory if 'import libxml2mod' failed.
2022-01-16 15:18:06 +01:00
Chun-wei Fan
6e169c1490 python: Port python 3.x module to Windows
On Windows, we don't have fcntl() which helps us to find out how a file was
opened, so we need to resort to the Windows API NtQueryInformationFile() in
ntdll.dll to help us, and compare the file access modes as appropriate to
deduce the modes we want to pass into fdopen().

As all official Python 3.x releases are built against newer Windows CRTs that
toughen checks on the validity of the file descriptor when we convert the fd to
a native Windows File Handle using _get_osfhandle(), we need to define an empty
handler so that the program does not abort if the fd that was passed in was
invalid; instead, we just return NULL if _get_osfhandle() could not return us a
valid Windows File Handle.
2022-01-16 15:18:06 +01:00
David King
9a9dd31ba6 Fix memory leak in libxml_C14NDocSaveTo
Found by Coverity.

https://bugzilla.redhat.com/show_bug.cgi?id=1938806
2022-01-16 14:22:26 +01:00
David King
d68c163723 Fix memory leak in libxml_saveNodeTo
Found by Coverity.

https://bugzilla.redhat.com/show_bug.cgi?id=1938806
2022-01-16 14:20:57 +01:00
Sam James
a0f9211b52 python/Makefile.am: use *_LIBADD, not *_LDFLAGS for LIBS
This fixes over-linking in the built Python modules with various libraries.

*_LIBADD is intended for adding additional libraries for linking, while
*_LDFLAGS is for miscellaneous extra flags (possibly user-supplied).

If using -Wl,-as-needed within user-supplied LDFLAGS, it is passed too
late (after the library link line) and therefore has no effect.

Notes:

* Noticed while working on Gentoo's migration to libxcrypt because
libxml2's Python modules were linking to libcrypt (and other libraries)
unexpectedly.

* It was suggested we could actually stop linking explicitly with all
of Python's libraries / don't copy its LDFLAGS, but this resolves
the original issue downstream and is a separate discussion. I couldn't
find any clear documentation for/against such a change.

Bug: https://bugs.gentoo.org/798942
Signed-off-by: Sam James <sam@gentoo.org>
2022-01-16 13:58:43 +01:00
Nick Wellnhofer
de5b624f10 Fix handling of unexpected EOF in xmlParseContent
Readd the XML_ERR_TAG_NOT_FINISHED error on unexpected EOF which was
removed in commit 62150ed2.

This commit also introduced a regression for direct users of
xmlParseContent. Unclosed tags weren't checked.
2021-05-08 20:47:36 +02:00
Nick Wellnhofer
3e80560d4b Fix line numbers in error messages for mismatched tags
Commit 62150ed2 introduced a small regression in the error messages for
mismatched tags. This typically only affected messages after the first
mismatch, but with custom SAX handlers all line numbers would be off.

This also fixes line numbers in the SAX push parser which were never
handled correctly.
2021-05-07 11:48:11 +02:00
Victor Stinner
ac5e99911a Convert python/libxml.c to PY_SSIZE_T_CLEAN
Define PY_SSIZE_T_CLEAN macro in python/libxml.c and cast the string
length (int len) explicitly to Py_ssize_t when passing a string to a
function call using PyObject_CallMethod() with the "s#" format.
2020-11-19 18:09:22 +01:00
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