1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-10-26 20:25:14 +03:00
Commit Graph

38 Commits

Author SHA1 Message Date
Nick Wellnhofer
0d90125859 Fix Windows compiler warnings in python/types.c 2022-09-04 18:36:04 +02:00
Nick Wellnhofer
71736b4e9a Fix libxml_PyFileGet
Broken in commit 75cdb6dd.
2022-09-04 18:36:04 +02:00
Nick Wellnhofer
75cdb6dd55 Fix unused variable warning in python/types.c 2022-09-02 18:33:36 +02:00
Nick Wellnhofer
ce8f3d1195 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").
2022-08-30 00:10:05 +02:00
Nick Wellnhofer
670701075b 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.
2022-04-21 02:41:58 +02: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
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
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
Armin K
6eea2f2c60 python: Fix compiler warnings when building python3 bindings 2013-06-03 22:03:28 +02: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
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
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
5d279c95f8 fix a memory errro when using namespace nodes returned from XPath queries,
* python/types.c: fix a memory errro when using namespace nodes
  returned from XPath queries, should fix #521699
* python/tests/Makefile.am python/tests/xpathns.py: add a specific
  regression test for it
Daniel

svn path=/trunk/; revision=3703
2008-03-12 09:32:04 +00:00
Daniel Veillard
db67015afe try to allow compilation on old python version should fix #398125 Daniel
* python/types.c: try to allow compilation on old python version
  should fix #398125
Daniel

svn path=/trunk/; revision=3632
2007-06-12 10:04:37 +00:00
Daniel Veillard
46459066c5 applied patch from Ross Reedstrom, Brian West and Stefan Anca to add
* python/libxml.py python/types.c: applied patch from Ross Reedstrom,
  Brian West and Stefan Anca to add XPointer suport to the Python bindings
Daniel
2006-10-10 08:40:04 +00:00
Daniel Veillard
a4bd369232 patch from Nic Ferrier to provide a better type mapping from XPath to
* python/types.c: patch from Nic Ferrier to provide a better type
  mapping from XPath to python
Daniel
2006-06-18 17:40:53 +00:00
Daniel Veillard
634ec27a80 Nic Ferrier found debug statement left in the XPath conversion code Daniel
* python/types.c: Nic Ferrier found debug statement left in the
  XPath conversion code
Daniel
2006-02-22 15:11:32 +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
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
Daniel Veillard
46da46493f applied patch from Stephane Bidoul for structured error handling from
* python/libxml2-python-api.xml python/libxml_wrap.h python/types.c
  python/tests/Makefile.am python/tests/tstLastError.py: applied
  patch from Stephane Bidoul for structured error handling from
  python, and the associated test
Daniel
2004-01-06 22:54:57 +00:00
Daniel Veillard
591b4be0fe fixed doc comment problems adding RelaxNG wrappers added a specific test
* xpath.c: fixed doc comment problems
* python/generator.py python/libxml_wrap.h python/types.c: adding
  RelaxNG wrappers
* python/tests/Makefile.am python/tests/relaxng.py: added a specific
  test of those early Python RelaxNG bindings
Daniel
2003-02-09 23:33:36 +00:00
Daniel Veillard
0e298ad23f fixing #104096 to compile without regexps Daniel
* configure.in valid.c xmlreader.c python/libxml_wrap.h
  python/types.c: fixing #104096 to compile without regexps
Daniel
2003-02-04 16:14:33 +00:00
Daniel Veillard
417be3ae08 patch from Stphane Bidoul for better per context error message APIs
* xmlreader.c python/drv_libxml2.py python/generator.py
  python/libxml.c python/libxml.py python/libxml_wrap.h
  python/types.c: patch from Stphane Bidoul for better per
  context error message APIs
* python/tests/ctxterror.py python/tests/readererr.py:
  update of the tests
Daniel
2003-01-20 21:26:34 +00:00
Daniel Veillard
e6227e0549 applied and fixed a patch from Stephane Bibould to provide per parser
* python/generator.py python/libxml.c python/libxml.py
  python/libxml_wrap.h python/types.c: applied and fixed a patch
  from Stephane Bibould to provide per parser error handlers at the
  Python level.
* python/tests/Makefile.am python/tests/ctxterror.py: added a
  regression test for it.
Daniel
2003-01-14 11:42:39 +00:00
Daniel Veillard
0eb38c7259 added the close and getattribute methods of XmlTextReader. added the
* xmlreader.c doc/libxml2-api.xml: added the close and getattribute
  methods of XmlTextReader.
* python/generator.py python/libxml_wrap.h python/types.c
  python/libxml2class.txt: added the reader to the Python bindings
* python/tests/Makefile.am python/tests/reader.py: added a specific
  test for the Python bindings of the Reader APIs
* parser.c: small cleanup.
Daniel
2002-12-14 23:00:35 +00:00
Daniel Veillard
c0ac069982 fixed bugs when passing result value tree to Python functions. Daniel
* python/types.c: fixed bugs when passing result value tree
  to Python functions.
Daniel
2002-10-20 21:31:50 +00:00
Daniel Veillard
bd9afb5290 improving some documentation comments found and fixed a mem leak with
* tree.c: improving some documentation comments
* xmlregexp.c: found and fixed a mem leak with python regression tests
* doc/*: rebuilt the doc and the API XML file including the
  xmlregexp.h xmlautomata.h and xmlunicode.h headers
* python/generator.py python/libxml2class.txt python/libxml_wrap.h
  python/types.c: added access to the XML Schemas regexps from
  python
* python/tests/Makefile.am python/tests/regexp.py: added a
  simple regexp bindings test
Daniel
2002-09-25 22:25:35 +00:00
Daniel Veillard
c6d4a933f0 updated the python bindings, added code for easier File I/O, and the
* python/generator.py python/libxml.c python/libxml.py
  python/libxml2-python-api.xml python/libxml2class.txt
  python/libxml_wrap.h python/types.c: updated the python
  bindings, added code for easier File I/O, and the ability to
  define a resolver from Python fixing bug #91635
* python/tests/Makefile.am python/tests/inbuf.py
  python/tests/outbuf.py python/tests/pushSAXhtml.py
  python/tests/resolver.py python/tests/serialize.py: updated
  and augmented the set of Python tests.
Daniel
2002-09-12 15:00:57 +00:00
Daniel Veillard
d2379010b1 Cleanup of the python Makefiles based on Jacob and James feedback, fixed
* libxml.spec.in python/Makefile.am python/tests/Makefile.am
  python/generator.py python/libxml.c python/types.c: Cleanup
  of the python Makefiles based on Jacob and James feedback,
  fixed the spec file accordingly, fixed the number of warning
  that passing my pedantic CFLAGS was generating. Conclusion
  is that Python includes are real crap.
Daniel
2002-03-15 22:24:56 +00:00
Daniel Veillard
79426f2b46 added the possibility of returning nodesets from XPath extension functions
* python/types.c python/tests/Makefile.am python/tests/xpathret.py:
  added the possibility of returning nodesets from XPath extension
  functions written in Python
Daniel
2002-03-01 16:14:17 +00:00
Daniel Veillard
a94ec6ff13 commiting some Python bindings work done while travelling Daniel
* python/*: commiting some Python bindings work done while travelling
Daniel
2002-03-01 13:00:53 +00:00
Daniel Veillard
6361da0c25 Added wrapper for the xmlURIPtr type, provided accessors, fixed the
* python/generator.py python/libxml.c python/libxml2-python-api.xml
  python/libxml2class.txt python/libxml_wrap.h python/types.c:
  Added wrapper for the xmlURIPtr type, provided accessors, fixed
  the accessor generator for strings
* python/tests/Makefile.am python/tests/tstURI.py: added a specific
  regression test.
Daniel
2002-02-23 10:10:33 +00:00
Daniel Veillard
c575b997d8 Changed to the MIT Licence updated the doc accordingly preparing 2.4.14
* Copyright Makefile.am README configure.in libxml.spec.in:
  Changed to the MIT Licence
* doc/FAQ.html doc/catalog.html doc/intro.html doc/xml.html
  doc/xmlio.html: updated the doc accordingly
* include/libxml/xmlwin32version.h configure.in: preparing
  2.4.14 release
* python/generator.py python/libxml.c python/libxml2-python-api.xml
  python/libxml2class.txt python/libxml_wrap.h python/types.c:
  fixed the const xmlChar * wrapper and generator, XPath extension
  functions now use the context as first argument
* python/tests/tstxpath.py python/tests/xpath.py
  python/tests/xpathext.py: Updated the tests accordingly
* tree.c: fixed bug #70067
Daniel
2002-02-08 13:28:40 +00:00
Daniel Veillard
7db3871bf5 cleanup always use stdout if output is NULL don't close filedescriptors
* Makefile.am: cleanup
* debugXML.c: always use stdout if output is NULL
* xmlIO.c: don't close filedescriptors passed to outputBuffers
* python/Makefile.am python/generator.py python/libxml2class.txt
  python/libxml_wrap.h python/types.c: augmented the number of bindings
  handling FILE * and XPath contexts
* python/tests/Makefile.am: avoid a stupid problem due to the
  use of TEST.
Daniel
2002-02-07 16:39:11 +00:00
Daniel Veillard
4e1b26cfeb change a small bit in the way valididy error messages get initialized
* parserInternals.c: change a small bit in the way valididy
  error messages get initialized
* python/TODO python/libxml.c python/libxml2-python-api.xml
  python/libxml2class.txt python/libxml_wrap.h python/types.c:
  added some memory debugging to track leaks at the libxml2 level
* python/tests/*.py: changed all tests to check for leaks,
  there is just one left in XPath extension registrations.
daniel
2002-02-03 20:13:06 +00:00
Daniel Veillard
3ce5257b29 cleanup added class for parser context, added first cut for push mode
* python/Makefile.am python/types.c: cleanup
* python/libxml.c python/libxml.py python/libxml_wrap.h
  python/generator.py python/libxml2-python-api.xml
  python/libxml2class.txt: added class for parser context, added
  first cut for push mode support. Added a framework to generate
  accessors functions.
* python/tests/Makefile.am python/tests/push.py: added a push
  test
Daniel
2002-02-03 15:08:05 +00:00