1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-01-04 05:17:37 +03:00
Commit Graph

104 Commits

Author SHA1 Message Date
Nick Wellnhofer
b1a0961858 Migrate from PyEval_ to PyObject_
PyEval_ functions are deprecated.

Fixes #208.
2022-08-29 17:21:19 +02:00
Nick Wellnhofer
a308c0cdf7 Deprecate old HTML SAX API 2022-08-25 21:04:57 +02:00
Nick Wellnhofer
51035c539e Generate deprecation warnings for old SAX API 2022-08-25 20:17:03 +02: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
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
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
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
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
Jared Yanovich
2a350ee9b4 Large batch of typo fixes
Closes #109.
2019-09-30 18:04:38 +02: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
Armin K
6eea2f2c60 python: Fix compiler warnings when building python3 bindings 2013-06-03 22:03:28 +02: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
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
Shaun McCance
519bc6a3ab Add support for xpathRegisterVariable in Python 2013-03-27 15:55:36 +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
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
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
Daniel Veillard
22030ef888 Restore code for Windows compilation
Try to keep as close to rc1 but still allow the change from Roumen for
mingw
2012-05-23 15:52:45 +08:00
Roumen Petrov
978ff224b2 use mingw C99 compatible functions {v}snprintf instead those from MSVC runtime 2012-05-21 10:20:09 +08:00
Stefan Kost
fdd3c04a61 python: remove unused variable 2011-05-25 17:20:05 +03:00
Stefan Kost
c31e06cc18 python: flag two unused args 2011-05-25 17:20:05 +03:00
Koop Mast
e306260f54 Fix compilation with Clang
Don't redefine vsnprintf if it is available
2010-11-03 16:10:26 +01:00
Daniel Veillard
594e5dfb48 Chasing dead assignments reported by clang-scan
* SAX2.c dict.c error.c hash.c nanohttp.c parser.c python/libxml.c
  relaxng.c runtest.c tree.c valid.c xinclude.c xmlregexp.c xmlsave.c
  xmlschemas.c xpath.c xpointer.c: mostly removing unneded affectations,
  but this led to a few real bugs and some part not yet understood
  (relaxng/interleave)
2009-09-07 14:58:47 +02:00
Daniel Veillard
da3fee406d Borland C fix from Moritz Both regenerate, workaround a problem for buffer
* trionan.c: Borland C fix from Moritz Both
* testapi.c: regenerate, workaround a problem for buffer testing
* xmlIO.c HTMLtree.c: new internal entry point to hide even better
  xmlAllocOutputBufferInternal
* tree.c: harden the code around buffer allocation schemes
* parser.c: restore the warning when namespace names are not absolute
  URIs
* runxmlconf.c: continue regression tests if we get the expected
  number of errors
* Makefile.am: run the python tests on make check
* xmlsave.c: handle the HTML documents and trees
* python/libxml.c: convert python serialization to the xmlSave APIs
  and avoid some horrible hacks
Daniel

svn path=/trunk/; revision=3790
2008-09-01 13:08:57 +00:00
Daniel Veillard
438ebbd59a fx compilation when configured without the reader should fix #513110
* xmlschemas.c runtest.c testapi.c include/libxml/xmlreader.h
  python/types.c python/libxml_wrap.h python/libxml.c: fx compilation
  when configured without the reader should fix #513110
* doc/*: regenerated
Daniel

svn path=/trunk/; revision=3743
2008-05-12 12:58:46 +00:00
Daniel Veillard
a3d230513c fix a memory leak in the python string handling when SAX event are passed
* python/libxml.c: fix a memory leak in the python string handling
  when SAX event are passed back to the python handlers
Daniel

svn path=/trunk/; revision=3573
2007-01-09 21:24:34 +00:00
William M. Brack
40cca61fc1 Added code submitted by Andreas Pakulat to provide node equality,
* python/libxml.c, python/libxml.py, python/tests/compareNodes.py,
  python/tests/Makefile.am:
  Added code submitted by Andreas Pakulat to provide node
  equality, inequality and hash functions, plus a single
  test program to check the functions (bugs 345779 + 345961).
2006-06-26 18:25:40 +00:00
Daniel Veillard
2728f845c5 more cleanups based on coverity reports. Daniel
* SAX2.c catalog.c encoding.c entities.c example/gjobread.c
  python/libxml.c: more cleanups based on coverity reports.
Daniel
2006-03-09 16:49:24 +00:00
Daniel Veillard
22eda2bc82 applied fix from Jakub Piotr Clapa for xmlAttr.parent(), closing #312181
* python/libxml.c: applied fix from Jakub Piotr Clapa for
  xmlAttr.parent(), closing #312181
Daniel
2005-08-01 05:20:16 +00:00
Daniel Veillard
4ea89f04cc don't output any message on failed resolver lookups, better done by the
* python/libxml.c: don't output any message on failed resolver lookups,
  better done by the python user provided resolver layer.
Daniel
2005-07-29 10:12:45 +00:00
Daniel Veillard
f9cf6f5a01 applied patch from Brent Hendricks adding namespace removal at the python
* python/libxml.c python/libxml.py: applied patch from Brent Hendricks
  adding namespace removal at the python level #300209
* python/tests/Makefile.am python/tests/nsdel.py: added the regression
  test
Daniel
2005-04-12 01:02:29 +00:00
Daniel Veillard
f2531afe41 fixed bug #168504 Daniel
* python/libxml.c: fixed bug #168504
Daniel
2005-03-31 11:06:29 +00:00
Daniel Veillard
bb8502c0ef applied patch from Brent Hendricks to avoid leak in python bindings when
* python/generator.py python/libxml.c: applied patch from Brent
  Hendricks to avoid leak in python bindings when using schemas
  error handlers.
Daniel
2005-03-30 07:40:35 +00:00
Daniel Veillard
25c90c589b try to fix a problem with valgrind. applied memory leak fix from Brent
* Makefile.am doc/examples/Makefile.am python/tests/Makefile.am
  xstc/Makefile.am: try to fix a problem with valgrind.
* python/generator.py python/libxml.c python/tests/Makefile.am
  python/tests/tstmem.py: applied memory leak fix from Brent Hendricks
  c.f. bug #165349
Daniel
2005-03-02 10:47:41 +00:00
Daniel Veillard
850ce9b658 Applied patch from Brent Hendricks adding support for late DTD validation.
* python/generator.py python/libxml.c python/libxml2class.txt
  python/libxml_wrap.h python/types.c: Applied patch from Brent
  Hendricks adding support for late DTD validation.
* python/tests/Makefile.am python/tests/dtdvalid.py
  python/tests/test.dtd: integrated the provided regression test
Daniel
2004-11-10 11:55:47 +00:00
Daniel Veillard
eff45a92da register xmlSchemaSetValidErrors, patch from Brent Hendricks in the
* python/libxml.c: register xmlSchemaSetValidErrors, patch from
  Brent Hendricks in the mailing-list
* include/libxml/valid.h HTMLparser.c SAX2.c valid.c
  parserInternals.c: fix #156626 and more generally how to find out
  if a validation contect is part of a parsing context or not. This
  can probably be improved to make 100% sure that vctxt->userData
  is the parser context too. It's a bit hairy because we can't
  change the xmlValidCtxt structure without breaking the ABI since
  this change xmlParserCtxt information indexes.
Daniel
2004-10-29 12:10:55 +00:00
Daniel Veillard
ad9fb7c06f fixed a problem occuring only in x86_64 when very large error messages are
* python/libxml.c: fixed a problem occuring only in x86_64 when
  very large error messages are raied to the Python handlers.
Daniel
2004-10-22 11:05:37 +00:00
Daniel Veillard
263ec86a75 applied patch from Malcolm Tredinnick fixing bug #154294 related to saving
* python/generator.py python/libxml.c python/tests/outbuf.py:
  applied patch from Malcolm Tredinnick fixing bug #154294
  related to saving to python file objects.
Daniel
2004-10-04 10:26:54 +00:00
Daniel Veillard
36505562ac fix a problem on last commit Daniel
* python/libxml.c: fix a problem on last commit
Daniel
2004-08-22 14:02:09 +00:00
Daniel Veillard
6ebf3c4c1a trying to remove some warning when compiling on Fedora Core 3 and 64bits
* xmllint.c xpath.c include/libxml/xpath.h
  include/libxml/xpathInternals.h python/libxml.c
  python/libxml_wrap.h: trying to remove some warning when compiling
  on Fedora Core 3 and 64bits
Daniel
2004-08-22 13:11:39 +00:00
Daniel Veillard
259f0dfa8b Applied patch from Torkel Lyng to add Schemas support to the Python
* xmlschemas.c include/libxml/xmlschemas.h python/generator.py
  python/libxml.c python/libxml_wrap.h python/types.c
  python/tests/schema.py python/tests/Makefile.am: Applied patch
  from Torkel Lyng to add Schemas support to the Python bindings
  and extend the schemas error API, registered a new test.
* doc/* elfgcchack.h: rebuilt to regenerate the bindings
Daniel
2004-08-18 09:13:18 +00:00
William M. Brack
c68d78d25a added a check on the argument for some classes (e.g. xmlDoc and xmlNode)
* python/generator.py: added a check on the argument for some
  classes (e.g. xmlDoc and xmlNode) to prevent a segfault (as
  reported on the list).  Further enhancement should be done
  to auto-create the appropriate object.
* python/libxml.c: minor fix for a warning message; added a
  routine, currently not used, to report the description of a
  PyCObject.
* python/libxml2class.txt: regenerated
2004-07-16 10:39:30 +00:00
William M. Brack
8e2cc6f2b5 Changed the number of XPath extension functions allowed to be
* python/libxml.c: Changed the number of XPath extension functions
  allowed to be variable-length (patch supplied by Marc-Antoine
  Parent, bug 143805).  Added code to "unregister" the functions
  when the parser cleanup takes place.
2004-07-03 23:28:52 +00:00
Daniel Veillard
529233ccdd some updates with memory debugging facilities while messing with libxslt
* xmlmemory.c python/libxml.c python/libxml2-python-api.xml:
  some updates with memory debugging facilities while messing
  with libxslt python bindings
Daniel
2004-07-02 12:23:44 +00:00
Daniel Veillard
f93a866079 applied patch from Stphane Bidoul to fix some Python bindings
* python/libxml.c python/generator.py python/libxml.py
  python/libxml2-python-api.xml python/libxml2class.txt:
  applied patch from Stphane Bidoul to fix some Python bindings
  initialization, then had to change the parserCleanup()
  to handle memory released there.
* xmlmemory.c: added more debugging comments.
Daniel
2004-07-01 12:56:30 +00:00
Daniel Veillard
656ce948ab Fixed bug #141529 i.e. various problems when building with --without-html
* xmllint.c xmlsave.c python/generator.py python/libxml.c: Fixed
  bug #141529 i.e. various problems when building with --without-html
Daniel
2004-04-30 23:11:45 +00:00
Daniel Veillard
d5e198ad45 applied patch from Anthony Carrico providing Python bindings for the
* python/libxml.c python/libxml.py: applied patch from Anthony Carrico
  providing Python bindings for the Canonicalization C14N support.
Daniel
2004-03-09 09:03:28 +00:00