python


Log

Author Commit Date CI Message
Nick Wellnhofer 45470611 2023-09-21T23:52:52 error: Make xmlGetLastError return a const error This is a slight break of the API, but users really shouldn't modify the global error struct. The goal is to make xmlLastError use static buffers for its strings eventually. This should warn people if they're abusing the struct.
Nick Wellnhofer fc26934e 2023-09-21T23:29:18 memory: Fix memory debugging with Windows threads On Windows, malloc hooks can be called after the final call to xmlCleanupParser in various tests. This means that xmlMemMutex can still be accessed if memory debugging is enabled, so the mutex should not be cleaned. This also means that tests may report spurious memory leaks on Windows. The old implementation avoided the issue by keeping track of all global state objects in a doubly linked list, so they could be cleaned during xmlCleanupParser. But as far as I can tell all memory will be freed eventually, so this is mostly an issue with our test suite.
Nick Wellnhofer 6c4ea468 2023-09-21T21:31:52 python: Fix tests Revert part of commit 138213ac.
Nick Wellnhofer 89ee0369 2023-09-21T15:13:16 python: Fix potential crash in tests/thread2.py Memory debugging must be initialized.
Nick Wellnhofer d6ba4033 2023-09-20T20:49:59 globals: Move remaining declarations to correct places globals.h is now deprecated. Sanity is restored.
Nick Wellnhofer 11a1839d 2023-09-20T17:54:48 globals: Move remaining globals back to correct header files This undoes a lot of damage.
Nick Wellnhofer db8b9722 2023-09-20T13:56:16 parser: Deprecate global parser options Note that setting global options has no effect anyway when using any of the modern parser API functions which take an option argument like xmlReadMemory or when using xmlCtxtUseOptions. Global options only have an effect when using old API functions xmlParse* or xmlSAXParse* or when using an xmlParserCtxt without calling xmlCtxtUseOptions. Unfortunately, many downstream projects still modify global parser options often without realizing that it has no effect. If necessary, switch to the modern API. Then you can safely remove all code that changes global options. Here's a list of deprecated functions and global variables together with the corresponding parser options. - xmlSubstituteEntitiesDefault, xmlSubstituteEntitiesDefaultValue Parser option XML_PARSE_NOENT - xmlKeepBlanksDefault, xmlKeepBlanksDefaultValue Inverse of parser option XML_PARSE_NOBLANKS - xmlPedanticParserDefault, xmlPedanticParserDefaultValue Parser option XML_PARSE_PEDANTIC - xmlLineNumbersDefault, xmlLineNumbersDefaultValue Always enabled by new API - xmlDoValidityCheckingDefaultValue Parser option XML_PARSE_DTDVALID - xmlGetWarningsDefaultValue Inverse of parser option XML_PARSE_NOWARNING - xmlLoadExtDtdDefaultValue Parser options XML_PARSE_DTDLOAD and XML_PARSE_DTDATTR
Nick Wellnhofer 4e1c13eb 2023-09-18T14:45:10 debug: Remove debugging code This is barely useful these days and only clutters the code base.
Nick Wellnhofer bbd918b2 2023-08-29T15:56:37 parser: Fix detection of null bytes Also suppress misleading extra errors. Fixes #122.
Nick Wellnhofer 138213ac 2023-08-15T12:49:27 python: Fix tests on MinGW Add the directory containing libxml2.dll with os.add_dll_directory to make tests work on MinGW. This has changed in Python 3.8 but for some reason, the issue only turned up with Python 3.11 on MinGW. Contrary to documentation, copying libxml2.dll into the directory containing the .pyd file doesn't work.
Nick Wellnhofer b463b38b 2023-04-30T16:19:28 .gitignore: Split up and rearrange .gitignore files
Nick Wellnhofer 886bf4e6 2023-04-30T15:35:47 Stop calling xmlMemoryDump This was used to check for memory leaks but could potentially create a .memdump file. These days, there are better ways to check for memory leaks.
Nick Wellnhofer 3ffcc03b 2023-03-13T19:38:41 parser: Deprecate more internal functions
David Kilzer cb1b8b85 2023-04-10T13:06:18 xmlValidatePopElement() can return invalid value (-1) Covered by: test/VC/ElementValid5 This only affects XML Reader API with LIBXML_REGEXP_ENABLED and LIBXML_VALID_ENABLED turned on. * result/VC/ElementValid5.rdr: - Update result to add missing error message. * python/tests/reader2.py: * result/VC/ElementValid6.rdr: * result/VC/ElementValid7.rdr: * result/valid/781333.xml.err.rdr: - Update result to fix grammar issue. * valid.c: (xmlValidatePopElement): - Check return value of xmlRegExecPushString() to handle -1, and assign 'ret = 0;' to return 0 from xmlValidatePopElement(). This change affects xmlTextReaderValidatePop() from xmlreader.c. - Fix grammar of error message by changing 'child' to 'children'.
Nick Wellnhofer 74aa61e0 2023-01-22T13:09:03 parser: Halt parser on DTD errors If we try to continue parsing after an error in the internal or external subset, entity expansion accounting gets more complicated. Simply halt the parser. Found with libFuzzer.
Nick Wellnhofer c74e5903 2022-12-21T22:24:50 Remove ancient TODOs
Nick Wellnhofer b47ebf04 2022-12-21T00:02:47 parser: Deprecate xmlString*DecodeEntities These are internal functions.
Ross Burton 4762c856 2022-12-06T21:40:01 Use python3 not python As per https://peps.python.org/pep-0394/, the python binary can be one of the following options: - Python 2 - Python 3 - Not exist All of the scripts in libxml2 use 'python', which may not exist. As Python 2 reached EOL on the 1st January 2020, it's safe to move the scripts to use python3 explicitly.
Ross Burton 0ac8c15e 2022-12-06T15:48:55 python/tests/reader2: use absolute paths everywhere The expected errors contain an relative path, but the messages from the parser contain absolute paths. However, due to the tests not actually failing if there was an error this wasn't noticed. Instead of putting relative paths in the expected messages use format() to embed the correct absolute path. Also use os.path.join() consistently when constructing paths to ensure uniformly formatted paths.
Ross Burton b9ba5e1d 2022-12-06T15:34:04 python/tests/reader2: always exit(1) if a test fails Batch up the errors in the first parse tests and ensure that the last tests exit with an error if they fail. Also remove an unused import.
Nick Wellnhofer 82bd2c37 2022-11-25T18:09:15 python: Fix memory leak checks xmlInitParser doesn't allocate memory anymore, so the checks can be simplified.
Chun-wei Fan 707ade22 2022-11-22T14:56:58 Visual Studio builds: Allow silencing deprecation warnings Define XML_IGNORE_DEPRECATION_WARNINGS and the corresponding XML_POP_WARNINGS for Visual Studio, and consequently define XML_IGNORE_FPTR_CAST_WARNINGS so that we do not get a compiler warning on Visual Studio by doing a __pragma(warning(pop)) without a corresponding __pragma(warning(push)). Also correct the documentation a bit for XML_POP_WARNINGS.
Nick Wellnhofer 97c0a9cf 2022-11-22T17:01:39 tests: Fix use-after-free in Python tests The nodeset must be freed before the document. Fixes #443.
Chun-wei Fan d7e698fc 2022-11-18T17:36:14 python/setup.py.in: Improve Windows import patching Move up the altImport function so that we ensure that it can be referred to and streamline it a bit, since we no longer attempt to build the libxslt Python bits here, at least on Windows.
Nick Wellnhofer ea8f7c92 2022-09-06T00:47:00 autotools: Disable parallel Python build Makefile rules with multiple output files don't work reliably with parallel builds. There are several ways to fix this issue with GNU Make, but they aren't portable. I'd be really interested in a totally reliable, cross-platform solution to this problem. .NOTPARALLEL is also understood by BSD make, at least.
Nick Wellnhofer 9d19c169 2022-09-06T00:21:28 python: Don't output missing generators during build
Nick Wellnhofer ad6f10a8 2022-09-04T17:21:51 Fix Python build on Windows Build Python bindings with -no-undefined on Windows. Remove libs that should already be set by PKG_CHECK_MODULE.
Nick Wellnhofer 0d901258 2022-09-04T16:41:43 Fix Windows compiler warnings in python/types.c
Nick Wellnhofer 71736b4e 2022-09-04T16:16:37 Fix libxml_PyFileGet Broken in commit 75cdb6dd.
Nick Wellnhofer 513d65fe 2022-09-02T16:45:06 Use AM_CFLAGS and AM_LDFLAGS consistently
Nick Wellnhofer 75cdb6dd 2022-09-02T16:47:25 Fix unused variable warning in python/types.c
Nick Wellnhofer ce8f3d11 2022-08-29T23:53:40 Fix libxml_PyFileGet with stdout on macOS macOS returns O_RDWR for standard file descriptors, but fails to write to stdout or stderr when opened with fdopen(dup_fd, "rw").
Nick Wellnhofer b1a09618 2022-08-29T17:21:19 Migrate from PyEval_ to PyObject_ PyEval_ functions are deprecated. Fixes #208.
Nick Wellnhofer b0916e0e 2022-08-26T17:57:58 Also clean *.pyc files for Python 2
Nick Wellnhofer 58fc89e8 2022-08-25T20:57:30 Deprecate internal parser functions
Nick Wellnhofer a308c0cd 2022-08-25T20:18:16 Deprecate old HTML SAX API
Nick Wellnhofer 51035c53 2022-08-25T19:53:04 Generate deprecation warnings for old SAX API
Nick Wellnhofer 7f7961df 2022-08-25T13:47:16 Remove generated files from distribution - libxml2.spec - libxml-2.0.pc - xml2-config - include/libxml/xmlversion.h - python/libxml2.py - python/libxml2-export.c - python/libxml2-py.c - python/libxml2-py.h - python/libxml2class.py - python/libxml2class.txt - python/setup.py
Nick Wellnhofer 75b5bc2b 2022-08-23T20:57:49 Deprecate some global variables Most of these should be completely unused.
Nick Wellnhofer d8f05db8 2022-05-14T22:28:19 Fix Python tests on macOS
Nick Wellnhofer 67070107 2022-04-20T23:17:14 Add configuration flag for XPointer locations support Add a new configuration flag that controls whether the outdated support for XPointer locations (ranges and points) is enabled. --with-xptr-locs # Autotools LIBXML2_WITH_XPTR_LOCS # CMake The latest spec for what it essentially an XPath extension seems to be this working draft from 2002: https://www.w3.org/TR/xptr-xpointer/ The xpointer() scheme is listed as "being reviewed" in the XPointer registry since at least 2006. libxml2 seems to be the only modern software that tries to implement this spec, but the code has many bugs and quality issues. The flag defaults to "off" and support for this extensions has to be requested explicitly. The relevant API functions are deprecated.
Nick Wellnhofer cacf6555 2022-04-13T16:43:15 Fix compiler warnings in Python code Add more deprecated functions to avoid compiler warnings when building the Python bindings.
David Seifert a62b31f4 2022-04-06T19:57:30 Use portable python shebangs * In conda or Gentoo Prefix, we don't want to use the system python and instead rely on PATH lookup.
Nick Wellnhofer 3f74e42b 2022-04-04T05:19:33 Simplify 'make check' targets
David Seifert 0137d987 2022-03-30T22:00:50 python/tests: open() relative to test scripts
David Seifert 438209f3 2022-03-30T16:51:15 python/Makefile.am: nest python docs in $(docdir)
David Seifert 9e304353 2022-03-30T16:51:14 python/Makefile.am: rely on global AM_INIT_AUTOMAKE * Even Debian oldoldstable has Automake 1.15 available nowadays.
David Seifert d9335077 2022-03-29T13:37:16 Use AM_PATH_PYTHON/PKG_CHECK_MODULES for python bindings * `AM_PATH_PYTHON` is a much more common idiom for building and installing python modules than writing your own. * It also makes cross-compiling the python bindings possible. Previously the `PYTHON_CFLAGS`/`PYTHON_LIBS` would have been based on the `--build` python and not the `--host` python. By using `pkg-config`, we can always redirect the python-X.Y.pc. Bug: https://bugs.gentoo.org/582130
Nick Wellnhofer 40483d0c 2022-03-06T13:55:48 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.
Nick Wellnhofer 4a8c71eb 2022-03-04T03:35:57 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.
Nick Wellnhofer ebc50097 2022-03-01T13:57:16 Warn when using deprecated functions from Python bindings This requires Python code to be run with -Wd.
Nick Wellnhofer 5bc5f076 2022-02-24T18:34:39 Fix build with older Python versions ModuleNotFoundError is only available since Python 3.6. Use the superclass ImportError instead. Fixes commit 3cc64a89. Fixes #347.
Nick Wellnhofer b057239b 2022-02-22T11:52:38 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.
Nick Wellnhofer 004fe9de 2022-02-20T19:02:31 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.
Nick Wellnhofer f2ad86fa 2022-02-17T19:05:26 Remove SVN keyword anchors
Nick Wellnhofer 10891111 2022-02-13T22:52:53 Redirect links to xmlsoft.org Documentation and releases are now available on gitlab.gnome.org.
Chun-wei Fan 3cc64a88 2021-07-22T15:46:38 setup.py.in: Try to import setuptools This way, we can build binary wheels easily if needed
Chun-wei Fan dbfe6151 2021-07-22T15:36:15 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
Chun-wei Fan 1b7d4e2b 2021-07-22T14:46:48 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.
Chun-wei Fan 6e169c14 2021-03-30T16:11:13 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.
David King 9a9dd31b 2021-07-14T15:28:56 Fix memory leak in libxml_C14NDocSaveTo Found by Coverity. https://bugzilla.redhat.com/show_bug.cgi?id=1938806
David King d68c1637 2021-07-14T15:23:11 Fix memory leak in libxml_saveNodeTo Found by Coverity. https://bugzilla.redhat.com/show_bug.cgi?id=1938806
Sam James a0f9211b 2021-06-28T02:03:15 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>
Nick Wellnhofer de5b624f 2021-05-08T20:21:29 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.
Nick Wellnhofer 3e80560d 2021-05-07T10:51:38 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.
Victor Stinner ac5e9991 2020-11-10T15:42:36 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.
Victor Stinner f42a0524 2020-11-09T18:19:31 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.
Miro Hrončok e4fb3684 2020-02-28T12:48:14 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
Nick Wellnhofer 20c60886 2020-03-08T17:19:42 Fix typos Resolves #133.
Pieter van Oostrum 8f62ac92 2020-01-01T19:16:10 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
Pieter van Oostrum 8c3e52eb 2019-12-31T21:49:58 Updated python/tests/tstLastError.py libxml2.registerErrorHandler(None,None): None is not acceptable as first argument failUnlessEqual replaced by assertEqual
Nick Wellnhofer d188eb92 2019-10-21T12:44:59 Make sure that Python tests exit with error code Closes #108.
Jared Yanovich 2a350ee9 2019-09-30T17:04:54 Large batch of typo fixes Closes #109.
Nick Wellnhofer 9d461ac7 2019-09-26T16:17:31 Adjust expected error in Python tests Closes #107.
Nick Wellnhofer 7f40ed01 2018-01-23T16:40:36 Fix Python bindings under Windows - Correct linker flags for MinGW-w64 - Adjust PATH to find libxml2.dll when running tests
Patrick Welche d910e99c 2017-11-06T16:20:25 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
Nick Wellnhofer 0c913916 2017-10-07T14:40:34 Remove generated file python/setup.py from version control
Daniel Veillard 4b4d3d85 2017-10-06T09:00:53 Release of libxml2-2.9.6 * configure.ac doc/xml.html doc/news.html: updated for release
Daniel Veillard 2960178f 2017-09-04T15:38:47 Release of libxml2-2.9.5 * configure.ac, doc/xslt.html: updated for the release * doc/*, python/setup.py, testapi.c: regenerated
Patrick Monnerat d1f90624 2017-07-27T11:20:02 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.
Nick Wellnhofer 83212ff4 2017-06-01T12:42:03 Fix expected error output in Python tests
Daniel Veillard 8effcb57 2016-05-09T10:31:09 Fix apibuild for a recently added construct commit c71f9305a99b6aa03cb08fab31106c9c56f1be4f added __XML_EXTERNC cpp construct which not understood by apibuild, leading to make dist failures, ask to ignore that construct.
Jan Pokorný bb654feb 2016-04-13T16:56:07 Fix typos: dictio{ nn -> n }ar{y,ies} Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
Michael Stahl 65112cb3 2016-01-18T12:46:41 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".
Daniel Veillard 6657afe8 2015-11-20T17:55:11 Release of libxml2-2.9.3 * configure.ac: updated * doc/*: regenerated
Daniel Veillard 726f67e2 2014-10-16T15:40:16 Release of libxml2-2.9.2
Roumen Petrov c2450d8b 2013-11-28T22:42:08 fix some tabs mixing incompatible with python3
Daniel Veillard af62eb4f 2014-10-13T16:40:56 Python generator bug raised by the const change the doc methode for xmlDocGetRootElement wasn't generated anymore
John Beck 6bea543e 2014-10-06T18:26:27 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.
Ron Angeles b3e488b0 2014-09-27T21:56:03 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.
Daniel Veillard 4b61cf61 2013-10-02T22:18:21 fix some tabs mixing incompatible with python3 Patrick Welche <prlw1@cam.ac.uk> raised this issue
Arfrever Frehtes Taifersar Arahesis 6dd7775f 2013-07-12T11:18:11 Another round of fixes for older versions of Python
Alexandre Rostovtsev 6c9c611b 2013-07-10T23:00:54 python: fix drv_libxml2.py for python3 compatibility https://bugzilla.gnome.org/show_bug.cgi?id=703979
Armin K 6eea2f2c 2013-05-30T19:00:50 python: Fix compiler warnings when building python3 bindings
Petr Sumbera 722923bc 2013-05-03T22:25:38 Fix for compilation with python 2.6.8 Remap PyCapsule to PyCObject based on the macro being available instead of using the python version
dcb 10ec19ab 2013-05-02T16:11:46 Fix missing break on last() function for attributes pointed out by cppcheck
Daniel Veillard f4e5a699 2013-04-19T15:36:36 Release of libxml2-2.9.1 * configure.in: bumped version * doc/*: updated the symbols file and regenerated
Daniel Veillard c0a8dd14 2013-04-19T15:02:33 Fix a linking error for python bindings Showing up apparently in Debian BTS distro https://bugzilla.gnome.org/show_bug.cgi?id=685515
Daniel Veillard bf4a8f0e 2013-04-02T10:27:57 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.
Daniel Veillard 87f3287d 2013-04-01T13:33:42 Fix tree iterators broken by 2to3 script