summaryrefslogtreecommitdiff
path: root/python
Commit message (Collapse)AuthorAgeFilesLines
* .gitignore: Split up and rearrange .gitignore filesNick Wellnhofer2023-04-301-0/+9
|
* Stop calling xmlMemoryDumpNick Wellnhofer2023-04-3046-47/+0
| | | | | | 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.
* parser: Deprecate more internal functionsNick Wellnhofer2023-04-261-0/+8
|
* xmlValidatePopElement() can return invalid value (-1)David Kilzer2023-04-101-1/+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'.
* parser: Halt parser on DTD errorsNick Wellnhofer2023-01-241-28/+0
| | | | | | | | 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.
* Remove ancient TODOsNick Wellnhofer2022-12-212-58/+0
|
* parser: Deprecate xmlString*DecodeEntitiesNick Wellnhofer2022-12-211-0/+2
| | | | These are internal functions.
* Use python3 not pythonRoss Burton2022-12-0749-49/+49
| | | | | | | | | | | | | 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.
* python/tests/reader2: use absolute paths everywhereRoss Burton2022-12-061-25/+26
| | | | | | | | | | | | 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.
* python/tests/reader2: always exit(1) if a test failsRoss Burton2022-12-061-1/+9
| | | | | | | 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.
* python: Fix memory leak checksNick Wellnhofer2022-11-271-23/+2
| | | | | xmlInitParser doesn't allocate memory anymore, so the checks can be simplified.
* Visual Studio builds: Allow silencing deprecation warningsChun-wei Fan2022-11-231-0/+4
| | | | | | | | | 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.
* tests: Fix use-after-free in Python testsNick Wellnhofer2022-11-221-1/+1
| | | | | | The nodeset must be freed before the document. Fixes #443.
* python/setup.py.in: Improve Windows import patchingChun-wei Fan2022-11-211-5/+5
| | | | | | 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.
* autotools: Disable parallel Python buildNick Wellnhofer2022-09-061-0/+4
| | | | | | | | | 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.
* python: Don't output missing generators during buildNick Wellnhofer2022-09-061-5/+5
|
* Fix Python build on WindowsNick Wellnhofer2022-09-041-2/+2
| | | | | Build Python bindings with -no-undefined on Windows. Remove libs that should already be set by PKG_CHECK_MODULE.
* Fix Windows compiler warnings in python/types.cNick Wellnhofer2022-09-042-19/+19
|
* Fix libxml_PyFileGetNick Wellnhofer2022-09-041-5/+1
| | | | Broken in commit 75cdb6dd.
* Use AM_CFLAGS and AM_LDFLAGS consistentlyNick Wellnhofer2022-09-021-2/+2
|
* Fix unused variable warning in python/types.cNick Wellnhofer2022-09-021-1/+4
|
* Fix libxml_PyFileGet with stdout on macOSNick Wellnhofer2022-08-301-23/+37
| | | | | macOS returns O_RDWR for standard file descriptors, but fails to write to stdout or stderr when opened with fdopen(dup_fd, "rw").
* Migrate from PyEval_ to PyObject_Nick Wellnhofer2022-08-291-17/+17
| | | | | | PyEval_ functions are deprecated. Fixes #208.
* Also clean *.pyc files for Python 2Nick Wellnhofer2022-08-261-1/+1
|
* Deprecate internal parser functionsNick Wellnhofer2022-08-251-0/+33
|
* Deprecate old HTML SAX APINick Wellnhofer2022-08-251-1/+4
|
* Generate deprecation warnings for old SAX APINick Wellnhofer2022-08-252-1/+10
|
* Remove generated files from distributionNick Wellnhofer2022-08-251-21/+17
| | | | | | | | | | | | | | - 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
* Deprecate some global variablesNick Wellnhofer2022-08-241-0/+3
| | | | Most of these should be completely unused.
* Fix Python tests on macOSNick Wellnhofer2022-06-201-0/+1
|
* Add configuration flag for XPointer locations supportNick Wellnhofer2022-04-212-0/+8
| | | | | | | | | | | | | | | | | | | | | 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.
* Fix compiler warnings in Python codeNick Wellnhofer2022-04-131-0/+15
| | | | | Add more deprecated functions to avoid compiler warnings when building the Python bindings.
* Use portable python shebangsDavid Seifert2022-04-0649-49/+49
| | | | | * In conda or Gentoo Prefix, we don't want to use the system python and instead rely on PATH lookup.
* Simplify 'make check' targetsNick Wellnhofer2022-04-042-6/+1
|
* python/tests: open() relative to test scriptsDavid Seifert2022-03-302-2/+7
|
* python/Makefile.am: nest python docs in $(docdir)David Seifert2022-03-302-2/+2
|
* python/Makefile.am: rely on global AM_INIT_AUTOMAKEDavid Seifert2022-03-301-1/+0
| | | | * Even Debian oldoldstable has Automake 1.15 available nowadays.
* Use AM_PATH_PYTHON/PKG_CHECK_MODULES for python bindingsDavid Seifert2022-03-291-7/+9
| | | | | | | | | | | * `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
* Deprecate module init and cleanup functionsNick Wellnhofer2022-03-061-0/+14
| | | | | | 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.
* Remove DOCBparserNick Wellnhofer2022-03-042-27/+0
| | | | | | | 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.
* Warn when using deprecated functions from Python bindingsNick Wellnhofer2022-03-013-3/+47
| | | | This requires Python code to be run with -Wd.
* Fix build with older Python versionsNick Wellnhofer2022-02-241-1/+1
| | | | | | | ModuleNotFoundError is only available since Python 3.6. Use the superclass ImportError instead. Fixes commit 3cc64a89. Fixes #347.
* More fixes to --without-valid buildNick Wellnhofer2022-02-221-0/+4
| | | | | | | 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.
* Deprecate IDREF-related functions in valid.hNick Wellnhofer2022-02-201-0/+7
| | | | | | | | | | | | | 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.
* Remove SVN keyword anchorsNick Wellnhofer2022-02-171-2/+0
|
* Redirect links to xmlsoft.orgNick Wellnhofer2022-02-132-5/+5
| | | | Documentation and releases are now available on gitlab.gnome.org.
* setup.py.in: Try to import setuptoolsChun-wei Fan2022-01-161-0/+6
| | | | This way, we can build binary wheels easily if needed
* Python distutils: Make DLL packaging more flexibleChun-wei Fan2022-01-161-28/+50
| | | | | | | | | | | 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
* tstmem.py: Try importing from libxmlmods.libxml2mod if neededChun-wei Fan2022-01-161-1/+6
| | | | | Distutils builds place libxml2mod.pyd under the libxmlmods subdir, so try this directory if 'import libxml2mod' failed.
* python: Port python 3.x module to WindowsChun-wei Fan2022-01-161-2/+126
| | | | | | | | | | | | | | 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.