From 7b1e5f9aab9336324a1e6234b8664cc131db1ffa Mon Sep 17 00:00:00 2001 From: Lumir Balhar Date: Wed, 14 Dec 2022 17:59:24 +0100 Subject: [PATCH 01/47] Update to 4.9.2 (rhbz#2153063) --- .gitignore | 1 + fix-namespace-count.patch | 53 --------------------------------------- python-lxml.spec | 10 +++----- sources | 2 +- 4 files changed, 6 insertions(+), 60 deletions(-) delete mode 100644 fix-namespace-count.patch diff --git a/.gitignore b/.gitignore index 4917099..8ae519b 100644 --- a/.gitignore +++ b/.gitignore @@ -58,3 +58,4 @@ lxml-2.2.7.tar.gz.asc /lxml-4.6.3.tar.gz /lxml-4.7.1.tar.gz /lxml-4.9.1.tar.gz +/lxml-4.9.2.tar.gz diff --git a/fix-namespace-count.patch b/fix-namespace-count.patch deleted file mode 100644 index 9a524b6..0000000 --- a/fix-namespace-count.patch +++ /dev/null @@ -1,53 +0,0 @@ -From c742576c105f40fc8b754fcae56fee4aa35840a3 Mon Sep 17 00:00:00 2001 -From: Stefan Behnel -Date: Tue, 19 Jul 2022 08:25:20 +0200 -Subject: [PATCH] Work around libxml2 bug in affected versions that failed to - reset the namespace count in the parser context. - -See https://gitlab.gnome.org/GNOME/libxml2/-/issues/378 ---- - src/lxml/includes/xmlparser.pxd | 1 + - src/lxml/parser.pxi | 3 +++ - src/lxml/tests/test_etree.py | 3 +-- - 3 files changed, 5 insertions(+), 2 deletions(-) - -diff --git a/src/lxml/includes/xmlparser.pxd b/src/lxml/includes/xmlparser.pxd -index a196e34bd..45acfc846 100644 ---- a/src/lxml/includes/xmlparser.pxd -+++ b/src/lxml/includes/xmlparser.pxd -@@ -144,6 +144,7 @@ cdef extern from "libxml/parser.h": - void* userData - int* spaceTab - int spaceMax -+ int nsNr - bint html - bint progressive - int inSubset -diff --git a/src/lxml/parser.pxi b/src/lxml/parser.pxi -index f5baf29b9..f0c8c6b64 100644 ---- a/src/lxml/parser.pxi -+++ b/src/lxml/parser.pxi -@@ -569,6 +569,9 @@ cdef class _ParserContext(_ResolverContext): - self._c_ctxt.disableSAX = 0 # work around bug in libxml2 - else: - xmlparser.xmlClearParserCtxt(self._c_ctxt) -+ # work around bug in libxml2 [2.9.10 .. 2.9.14]: -+ # https://gitlab.gnome.org/GNOME/libxml2/-/issues/378 -+ self._c_ctxt.nsNr = 0 - - cdef int prepare(self, bint set_document_loader=True) except -1: - cdef int result -diff --git a/src/lxml/tests/test_etree.py b/src/lxml/tests/test_etree.py -index 8bf82c084..0339796d6 100644 ---- a/src/lxml/tests/test_etree.py -+++ b/src/lxml/tests/test_etree.py -@@ -1491,8 +1491,7 @@ def test_walk_after_parse_failure(self): - # This would be the expected result, because there was no namespace - pass - else: -- # This is a bug in libxml2 -- assert not ns, repr(ns) -+ assert False, "Found unexpected namespace '%s'" % ns - - def test_itertext_comment_pi(self): - # https://bugs.launchpad.net/lxml/+bug/1844674 diff --git a/python-lxml.spec b/python-lxml.spec index 7170e82..40464a7 100644 --- a/python-lxml.spec +++ b/python-lxml.spec @@ -1,5 +1,5 @@ Name: python-lxml -Version: 4.9.1 +Version: 4.9.2 Release: 1%{?dist} Summary: XML processing library combining libxml2/libxslt with the ElementTree API @@ -11,11 +11,6 @@ License: BSD-3-Clause AND MIT-CMU AND MIT URL: https://github.com/lxml/lxml Source: %{pypi_source lxml} -# Work around libxml2 bug in affected versions that failed to reset the -# namespace count in the parser context. -# Resolved upstream: https://github.com/lxml/lxml/commit/c742576c105f40fc8b754fcae56fee4aa35840a3 -Patch: fix-namespace-count.patch - BuildRequires: gcc BuildRequires: libxml2-devel BuildRequires: libxslt-devel @@ -81,6 +76,9 @@ cp -a build/lib.%{python3_platform}-*/* src/ %doc README.rst src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt %changelog +* Wed Dec 14 2022 Lumír Balhar - 4.9.2-1 +- Update to 4.9.2 (rhbz#2153063) + * Wed Sep 14 2022 Charalampos Stratakis - 4.9.1-1 - Update to 4.9.1 - Fix for CVE-2022-2309 diff --git a/sources b/sources index b5e3cd2..ff93acf 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (lxml-4.9.1.tar.gz) = d7ec55c7db2c63a716ca5f4d833706d90fc76c944885e010fcdb96786bcfe796994e438450cf4e8e6e75d702e21fb16971f28f854d7a1f76c34e4ae315414d84 +SHA512 (lxml-4.9.2.tar.gz) = 4597784c96219145fef30607f257097ad312264a6796e65b3dc74463853cd29f55379b6a903b401c1120750126b57f58dd9fc459dd453e57030883fc76b87ea3 From 1c38e85b1f9c5e21959fde92443b08ea903f4add Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 20 Jan 2023 14:31:02 +0000 Subject: [PATCH 02/47] Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- python-lxml.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-lxml.spec b/python-lxml.spec index 40464a7..bddd9b4 100644 --- a/python-lxml.spec +++ b/python-lxml.spec @@ -1,6 +1,6 @@ Name: python-lxml Version: 4.9.2 -Release: 1%{?dist} +Release: 2%{?dist} Summary: XML processing library combining libxml2/libxslt with the ElementTree API # The lxml project is licensed under BSD-3-Clause @@ -76,6 +76,9 @@ cp -a build/lib.%{python3_platform}-*/* src/ %doc README.rst src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt %changelog +* Fri Jan 20 2023 Fedora Release Engineering - 4.9.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + * Wed Dec 14 2022 Lumír Balhar - 4.9.2-1 - Update to 4.9.2 (rhbz#2153063) From 26d49d1f7e949d3e5b211d0948be574323bae760 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hrn=C4=8Diar?= Date: Thu, 18 May 2023 09:18:46 +0200 Subject: [PATCH 03/47] Skip failing test to avoid FTBFS --- ...-failing-test-test_html_prefix_nsmap.patch | 34 +++++++++++++++++++ python-lxml.spec | 8 ++++- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 Skip-failing-test-test_html_prefix_nsmap.patch diff --git a/Skip-failing-test-test_html_prefix_nsmap.patch b/Skip-failing-test-test_html_prefix_nsmap.patch new file mode 100644 index 0000000..7d936e3 --- /dev/null +++ b/Skip-failing-test-test_html_prefix_nsmap.patch @@ -0,0 +1,34 @@ +From 91729cf581f764c3321f644206568f18d0fc92f4 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hrn=C4=8Diar?= +Date: Thu, 18 May 2023 08:00:48 +0200 +Subject: [PATCH] Skip failing test test_html_prefix_nsmap + +Upstream issue: https://bugs.launchpad.net/lxml/+bug/2016939 +--- + src/lxml/tests/test_etree.py | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/lxml/tests/test_etree.py b/src/lxml/tests/test_etree.py +index 0339796..1994a7f 100644 +--- a/src/lxml/tests/test_etree.py ++++ b/src/lxml/tests/test_etree.py +@@ -27,6 +27,8 @@ from .common_imports import SillyFileLike, LargeFileLikeUnicode, doctest, make_d + from .common_imports import canonicalize, _str, _bytes + from .common_imports import SimpleFSPath + ++from unittest import skip ++ + print(""" + TESTED VERSION: %s""" % etree.__version__ + """ + Python: %r""" % (sys.version_info,) + """ +@@ -3067,6 +3069,7 @@ class ETreeOnlyTestCase(HelperTestCase): + self.assertEqual(re, e.nsmap) + self.assertEqual(r, s.nsmap) + ++ @skip + def test_html_prefix_nsmap(self): + etree = self.etree + el = etree.HTML('aa').find('.//page-description') +-- +2.40.1 + diff --git a/python-lxml.spec b/python-lxml.spec index bddd9b4..4ddd4f6 100644 --- a/python-lxml.spec +++ b/python-lxml.spec @@ -1,6 +1,6 @@ Name: python-lxml Version: 4.9.2 -Release: 2%{?dist} +Release: 3%{?dist} Summary: XML processing library combining libxml2/libxslt with the ElementTree API # The lxml project is licensed under BSD-3-Clause @@ -11,6 +11,9 @@ License: BSD-3-Clause AND MIT-CMU AND MIT URL: https://github.com/lxml/lxml Source: %{pypi_source lxml} +# Upstream issue: https://bugs.launchpad.net/lxml/+bug/2016939 +Patch: Skip-failing-test-test_html_prefix_nsmap.patch + BuildRequires: gcc BuildRequires: libxml2-devel BuildRequires: libxslt-devel @@ -76,6 +79,9 @@ cp -a build/lib.%{python3_platform}-*/* src/ %doc README.rst src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt %changelog +* Mon May 29 2023 Tomáš Hrnčiar - 4.9.2-3 +- Skip failing test to avoid FTBFS + * Fri Jan 20 2023 Fedora Release Engineering - 4.9.2-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild From e3db9bc24a0ba496be49d476b3db141a20e6e6ca Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Tue, 23 May 2023 21:50:32 -0400 Subject: [PATCH 04/47] Disable extras in RHEL builds The `buildrequire_extras` dependencies are unwanted in RHEL. --- python-lxml.spec | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/python-lxml.spec b/python-lxml.spec index 4ddd4f6..9915b64 100644 --- a/python-lxml.spec +++ b/python-lxml.spec @@ -1,6 +1,6 @@ Name: python-lxml Version: 4.9.2 -Release: 3%{?dist} +Release: 4%{?dist} Summary: XML processing library combining libxml2/libxslt with the ElementTree API # The lxml project is licensed under BSD-3-Clause @@ -27,7 +27,8 @@ BuildRequires: python3-devel # - [html5] Requires html5lib BuildRequires lxml # - [htmlsoup] Requires beautifulsoup4 Requires lxml # Hence we provide a bcond to disable this buildtime requirement. -%bcond buildrequire_extras 1 +# These subpackages are disabled outright in RHEL builds. +%bcond buildrequire_extras %{undefined rhel} %global _description \ lxml is a Pythonic, mature binding for the libxml2 and libxslt libraries. It\ @@ -39,15 +40,19 @@ XML Schema, XSLT, C14N and much more. %package -n python3-lxml Summary: %{summary} +%if %{undefined rhel} Suggests: python3-lxml+cssselect Suggests: python3-lxml+html5 Suggests: python3-lxml+htmlsoup +%endif %description -n python3-lxml %{_description} Python 3 version. +%if %{undefined rhel} %pyproject_extras_subpkg -n python3-lxml cssselect html5 htmlsoup +%endif %prep %autosetup -n lxml-%{version} -p1 @@ -79,6 +84,9 @@ cp -a build/lib.%{python3_platform}-*/* src/ %doc README.rst src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt %changelog +* Tue May 30 2023 Yaakov Selkowitz - 4.9.2-4 +- Disable extra subpackages in RHEL builds + * Mon May 29 2023 Tomáš Hrnčiar - 4.9.2-3 - Skip failing test to avoid FTBFS From af2ab5968770209093c6eb8e1ceaf61996db4a0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 30 May 2023 22:29:46 +0200 Subject: [PATCH 05/47] Rework the extras bcond to control the entire extras feature --- python-lxml.spec | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/python-lxml.spec b/python-lxml.spec index 9915b64..7e618b2 100644 --- a/python-lxml.spec +++ b/python-lxml.spec @@ -19,16 +19,13 @@ BuildRequires: libxml2-devel BuildRequires: libxslt-devel BuildRequires: python3-devel -# It is a good idea to BuildRequire the runtime requirements of the [extras] we build. -# That way, we ensure all the [extras] we build are installable, -# and we possibly run tests that would otherwise be skipped. -# However, some of the extras here create a dependency loop. +# Some of the extras create a build dependency loop. # - [cssselect] Requires cssselect BuildRequires lxml # - [html5] Requires html5lib BuildRequires lxml # - [htmlsoup] Requires beautifulsoup4 Requires lxml -# Hence we provide a bcond to disable this buildtime requirement. -# These subpackages are disabled outright in RHEL builds. -%bcond buildrequire_extras %{undefined rhel} +# Hence we provide a bcond to disable the extras altogether. +# By default, the extras are disabled in RHEL, to avoid dependencies. +%bcond extras %{undefined rhel} %global _description \ lxml is a Pythonic, mature binding for the libxml2 and libxslt libraries. It\ @@ -40,7 +37,7 @@ XML Schema, XSLT, C14N and much more. %package -n python3-lxml Summary: %{summary} -%if %{undefined rhel} +%if %{with extras} Suggests: python3-lxml+cssselect Suggests: python3-lxml+html5 Suggests: python3-lxml+htmlsoup @@ -50,7 +47,7 @@ Suggests: python3-lxml+htmlsoup Python 3 version. -%if %{undefined rhel} +%if %{with extras} %pyproject_extras_subpkg -n python3-lxml cssselect html5 htmlsoup %endif @@ -58,7 +55,7 @@ Python 3 version. %autosetup -n lxml-%{version} -p1 %generate_buildrequires -%pyproject_buildrequires -x source%{?with_buildrequire_extras:,cssselect,html5,htmlsoup} +%pyproject_buildrequires -x source%{?with_extras:,cssselect,html5,htmlsoup} # Remove pregenerated Cython C sources # We need to do this after %%pyproject_buildrequires because setup.py errors # without Cython and without the .c files. From 9d95f5a04edc386313fa854541971b3af07bcae1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Fri, 7 Apr 2023 13:33:26 +0200 Subject: [PATCH 06/47] Remove the isoschematron submodule See https://gitlab.com/fedora/legal/fedora-license-data/-/issues/154 Cherry-picked from https://gitlab.com/redhat/centos-stream/rpms/python3.11-lxml/-/commit/7f6d5f61df3d053b7cc392f03b12f059fb97a4a3 Co-Authored-By: Charalampos Stratakis --- .gitignore | 1 + get-lxml-source.sh | 29 +++++++++++++++++++++++++++++ python-lxml.spec | 23 ++++++++++++++++++----- sources | 2 +- 4 files changed, 49 insertions(+), 6 deletions(-) create mode 100755 get-lxml-source.sh diff --git a/.gitignore b/.gitignore index 8ae519b..d44f10e 100644 --- a/.gitignore +++ b/.gitignore @@ -59,3 +59,4 @@ lxml-2.2.7.tar.gz.asc /lxml-4.7.1.tar.gz /lxml-4.9.1.tar.gz /lxml-4.9.2.tar.gz +/lxml-4.9.2-no-isoschematron.tar.gz diff --git a/get-lxml-source.sh b/get-lxml-source.sh new file mode 100755 index 0000000..9d79f3a --- /dev/null +++ b/get-lxml-source.sh @@ -0,0 +1,29 @@ +#! /bin/bash -ex + +# Download a release of lxml (if missing) and remove the isoschematron module from it + +version=$1 + +if [ -z "${version}" ]; then + echo "Usage: $0 VERSION" >& 2 + echo "" >& 2 + echo "example: $0 4.9.2" >& 2 + exit 1 +fi + +versionedname=lxml-${version} +orig_archive=${versionedname}.tar.gz +new_archive=${versionedname}-no-isoschematron.tar.gz + +if [ ! -e ${orig_archive} ]; then + wget -N https://files.pythonhosted.org/packages/source/l/lxml/${orig_archive} +fi + +deleted_module=lxml-${version}/src/lxml/isoschematron/ +deleted_test=lxml-${version}/src/lxml/tests/test_isoschematron.py + +# tar --delete does not operate on compressed archives, so do +# gz decompression explicitly +gzip --decompress ${orig_archive} +tar -v --delete -f ${orig_archive//.gz} {$deleted_module,$deleted_test} +gzip -cf ${orig_archive//.gz} > ${new_archive} diff --git a/python-lxml.spec b/python-lxml.spec index 7e618b2..686452b 100644 --- a/python-lxml.spec +++ b/python-lxml.spec @@ -1,15 +1,20 @@ Name: python-lxml Version: 4.9.2 -Release: 4%{?dist} +Release: 5%{?dist} Summary: XML processing library combining libxml2/libxslt with the ElementTree API # The lxml project is licensed under BSD-3-Clause # Some code is derived from ElementTree and cElementTree # thus using the MIT-CMU elementtree license -# .xsl schematron files are under the MIT license -License: BSD-3-Clause AND MIT-CMU AND MIT +License: BSD-3-Clause AND MIT-CMU URL: https://github.com/lxml/lxml -Source: %{pypi_source lxml} + +# We use the get-lxml-source.sh script to generate the tarball +# without the isoschematron submodule as it contains a problematic +# license. +# See: https://gitlab.com/fedora/legal/fedora-license-data/-/issues/154 +Source0: lxml-%{version}-no-isoschematron.tar.gz +Source1: get-lxml-source.sh # Upstream issue: https://bugs.launchpad.net/lxml/+bug/2016939 Patch: Skip-failing-test-test_html_prefix_nsmap.patch @@ -53,6 +58,11 @@ Python 3 version. %prep %autosetup -n lxml-%{version} -p1 +# Remove isoschematron module due to problematic license +sed -i "s/, 'lxml.isoschematron'//" setup.py +# Remove the doctests for it (the documentation is not shipped) +# The command [d]eletes all lines from the first pattern to the second +sed -Ei '/^Schematron$/,/^\(Pre-ISO-Schematron\)$/d' doc/validation.txt %generate_buildrequires %pyproject_buildrequires -x source%{?with_extras:,cssselect,html5,htmlsoup} @@ -78,9 +88,12 @@ cp -a build/lib.%{python3_platform}-*/* src/ %files -n python3-lxml -f %{pyproject_files} %license doc/licenses/BSD.txt doc/licenses/elementtree.txt -%doc README.rst src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt +%doc README.rst %changelog +* Wed May 31 2023 Miro Hrončok - 4.9.2-5 +- Remove the isoschematron submodule + * Tue May 30 2023 Yaakov Selkowitz - 4.9.2-4 - Disable extra subpackages in RHEL builds diff --git a/sources b/sources index ff93acf..2599e86 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (lxml-4.9.2.tar.gz) = 4597784c96219145fef30607f257097ad312264a6796e65b3dc74463853cd29f55379b6a903b401c1120750126b57f58dd9fc459dd453e57030883fc76b87ea3 +SHA512 (lxml-4.9.2-no-isoschematron.tar.gz) = 3ee80967dfa69c840a27ad99546727346f8bb058ed64bf93d2aa8959fb3000e78c1227f4b8709d25aaadeb9a4ccdf97a03eb53a1171de8feda93fbeaa15a8b39 From 4391bca196646e3817051371c559b71b0db8a6fa Mon Sep 17 00:00:00 2001 From: Python Maint Date: Tue, 13 Jun 2023 21:36:20 +0200 Subject: [PATCH 07/47] Bootstrap for Python 3.12 --- python-lxml.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/python-lxml.spec b/python-lxml.spec index 686452b..2cdd85e 100644 --- a/python-lxml.spec +++ b/python-lxml.spec @@ -1,6 +1,7 @@ +%global _without_extras 1 Name: python-lxml Version: 4.9.2 -Release: 5%{?dist} +Release: 6%{?dist} Summary: XML processing library combining libxml2/libxslt with the ElementTree API # The lxml project is licensed under BSD-3-Clause @@ -91,6 +92,9 @@ cp -a build/lib.%{python3_platform}-*/* src/ %doc README.rst %changelog +* Tue Jun 13 2023 Python Maint - 4.9.2-6 +- Bootstrap for Python 3.12 + * Wed May 31 2023 Miro Hrončok - 4.9.2-5 - Remove the isoschematron submodule From a1fda595629a70533aecda98a67e97377f2680e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Wed, 14 Jun 2023 18:32:37 +0200 Subject: [PATCH 08/47] Avoid using the deprecated "imp" module (removed in Python 3.12) --- 07db761f9f.patch | 32 ++++++++++++++++++++++++++++++++ c6b7e621e4.patch | 24 ++++++++++++++++++++++++ python-lxml.spec | 4 ++++ 3 files changed, 60 insertions(+) create mode 100644 07db761f9f.patch create mode 100644 c6b7e621e4.patch diff --git a/07db761f9f.patch b/07db761f9f.patch new file mode 100644 index 0000000..f6070a5 --- /dev/null +++ b/07db761f9f.patch @@ -0,0 +1,32 @@ +From 07db761f9f027d1814a43686cda6fca26e37a931 Mon Sep 17 00:00:00 2001 +From: Stefan Behnel +Date: Thu, 11 May 2023 10:29:02 +0200 +Subject: [PATCH] Avoid using the deprecated "imp" module. + +Closes https://bugs.launchpad.net/lxml/+bug/2018137 +--- + src/lxml/html/tests/test_html5parser.py | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/src/lxml/html/tests/test_html5parser.py b/src/lxml/html/tests/test_html5parser.py +index 56afe98b7..bcf7f1b12 100644 +--- a/src/lxml/html/tests/test_html5parser.py ++++ b/src/lxml/html/tests/test_html5parser.py +@@ -1,5 +1,4 @@ + import os +-import imp + try: + from StringIO import StringIO + except ImportError: # python 3 +@@ -45,7 +44,10 @@ def find_module(self, fullname, path=None): + return None + + def load_module(self, fullname): +- mod = sys.modules.setdefault(fullname, imp.new_module(fullname)) ++ fake_module = object() ++ fake_module.__qualname__ = fullname ++ fake_module.__name__ = fullname.rsplit('.', 1)[-1] ++ mod = sys.modules.setdefault(fullname, fake_module) + mod.__file__, mod.__loader__, mod.__path__ = "", self, [] + mod.__dict__.update(self.mocks[fullname]) + return mod diff --git a/c6b7e621e4.patch b/c6b7e621e4.patch new file mode 100644 index 0000000..fbdb61d --- /dev/null +++ b/c6b7e621e4.patch @@ -0,0 +1,24 @@ +From c6b7e621e4696c02bf8f6ea423ffbbf2109748ab Mon Sep 17 00:00:00 2001 +From: Stefan Behnel +Date: Thu, 11 May 2023 10:30:15 +0200 +Subject: [PATCH] Avoid using the deprecated "imp" module. + +Closes https://bugs.launchpad.net/lxml/+bug/2018137 +--- + src/lxml/html/tests/test_html5parser.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/lxml/html/tests/test_html5parser.py b/src/lxml/html/tests/test_html5parser.py +index bcf7f1b12..57878a5e3 100644 +--- a/src/lxml/html/tests/test_html5parser.py ++++ b/src/lxml/html/tests/test_html5parser.py +@@ -44,7 +44,8 @@ def find_module(self, fullname, path=None): + return None + + def load_module(self, fullname): +- fake_module = object() ++ class Cls: pass ++ fake_module = Cls() + fake_module.__qualname__ = fullname + fake_module.__name__ = fullname.rsplit('.', 1)[-1] + mod = sys.modules.setdefault(fullname, fake_module) diff --git a/python-lxml.spec b/python-lxml.spec index 2cdd85e..fb979e8 100644 --- a/python-lxml.spec +++ b/python-lxml.spec @@ -20,6 +20,10 @@ Source1: get-lxml-source.sh # Upstream issue: https://bugs.launchpad.net/lxml/+bug/2016939 Patch: Skip-failing-test-test_html_prefix_nsmap.patch +# Avoid using the deprecated "imp" module (removed in Python 3.12) +Patch: https://github.com/lxml/lxml/commit/07db761f9f.patch +Patch: https://github.com/lxml/lxml/commit/c6b7e621e4.patch + BuildRequires: gcc BuildRequires: libxml2-devel BuildRequires: libxslt-devel From 1a4b58646cb19208bd3da50d0cfed08decec0e8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Wed, 14 Jun 2023 19:47:00 +0200 Subject: [PATCH 09/47] Don't run html5lib tests --without extras For unknown reason, the tests fail with: ... File "/builddir/build/BUILD/lxml-4.9.2/src/lxml/html/tests/test_html5parser.py", line 304, in call_it from lxml.html.html5parser import parse File "/builddir/build/BUILD/lxml-4.9.2/src/lxml/html/html5parser.py", line 7, in from html5lib import HTMLParser as _HTMLParser ModuleNotFoundError: No module named 'html5lib' But only with Python 3.12, not with Python 3.11. --- python-lxml.spec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python-lxml.spec b/python-lxml.spec index fb979e8..1cfcf6a 100644 --- a/python-lxml.spec +++ b/python-lxml.spec @@ -68,6 +68,8 @@ sed -i "s/, 'lxml.isoschematron'//" setup.py # Remove the doctests for it (the documentation is not shipped) # The command [d]eletes all lines from the first pattern to the second sed -Ei '/^Schematron$/,/^\(Pre-ISO-Schematron\)$/d' doc/validation.txt +# Don't run html5lib tests --without extras +%{!?without_extras:rm src/lxml/html/tests/test_html5parser.py} %generate_buildrequires %pyproject_buildrequires -x source%{?with_extras:,cssselect,html5,htmlsoup} From 0e1ee829e64be02dba8e7522482d649d00ae62e9 Mon Sep 17 00:00:00 2001 From: Python Maint Date: Fri, 16 Jun 2023 08:19:17 +0200 Subject: [PATCH 10/47] Rebuilt for Python 3.12 --- python-lxml.spec | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/python-lxml.spec b/python-lxml.spec index 1cfcf6a..ed69d6d 100644 --- a/python-lxml.spec +++ b/python-lxml.spec @@ -1,7 +1,6 @@ -%global _without_extras 1 Name: python-lxml Version: 4.9.2 -Release: 6%{?dist} +Release: 7%{?dist} Summary: XML processing library combining libxml2/libxslt with the ElementTree API # The lxml project is licensed under BSD-3-Clause @@ -98,6 +97,9 @@ cp -a build/lib.%{python3_platform}-*/* src/ %doc README.rst %changelog +* Fri Jun 16 2023 Python Maint - 4.9.2-7 +- Rebuilt for Python 3.12 + * Tue Jun 13 2023 Python Maint - 4.9.2-6 - Bootstrap for Python 3.12 From 3c925c366d80271905baa03285e1d4316a90f4aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Fri, 14 Jul 2023 11:52:40 +0200 Subject: [PATCH 11/47] Only drop the license-problematic file from ISO-Schematron, not the entire module --- .gitignore | 1 + 380.patch | 24 ++++ ...ion-of-ISO-Schematron-files-optional.patch | 116 ++++++++++++++++++ get-lxml-source.sh | 7 +- python-lxml.spec | 27 ++-- sources | 2 +- 6 files changed, 162 insertions(+), 15 deletions(-) create mode 100644 380.patch create mode 100644 Make-the-validation-of-ISO-Schematron-files-optional.patch diff --git a/.gitignore b/.gitignore index d44f10e..e39c3f5 100644 --- a/.gitignore +++ b/.gitignore @@ -60,3 +60,4 @@ lxml-2.2.7.tar.gz.asc /lxml-4.9.1.tar.gz /lxml-4.9.2.tar.gz /lxml-4.9.2-no-isoschematron.tar.gz +/lxml-4.9.2-no-isoschematron-rng.tar.gz diff --git a/380.patch b/380.patch new file mode 100644 index 0000000..daac445 --- /dev/null +++ b/380.patch @@ -0,0 +1,24 @@ +From d18f2f22218ea0e0b5327b5a2bda789afdf16e41 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= +Date: Fri, 14 Jul 2023 12:18:25 +0200 +Subject: [PATCH] Skip test_isoschematron.test_schematron_invalid_schema_empty + without the RNG file + +The expected SchematronParseError only happens when validate_schema is true. +--- + src/lxml/tests/test_isoschematron.py | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/lxml/tests/test_isoschematron.py b/src/lxml/tests/test_isoschematron.py +index 6d2aa3fb6..900f257c3 100644 +--- a/src/lxml/tests/test_isoschematron.py ++++ b/src/lxml/tests/test_isoschematron.py +@@ -55,6 +55,8 @@ def test_schematron_empty_pattern(self): + schema = isoschematron.Schematron(schema) + self.assertTrue(schema) + ++ @unittest.skipIf(not isoschematron.schematron_schema_valid_supported, ++ 'SchematronParseError is risen only when validate_schema is true') + def test_schematron_invalid_schema_empty(self): + schema = self.parse('''\ + diff --git a/Make-the-validation-of-ISO-Schematron-files-optional.patch b/Make-the-validation-of-ISO-Schematron-files-optional.patch new file mode 100644 index 0000000..d07006e --- /dev/null +++ b/Make-the-validation-of-ISO-Schematron-files-optional.patch @@ -0,0 +1,116 @@ +From 4ac96ce046e9f58141bd66639ba8cb1fad9deefb Mon Sep 17 00:00:00 2001 +From: Stefan Behnel +Date: Wed, 12 Jul 2023 16:59:07 +0200 +Subject: [PATCH] Make the validation of ISO-Schematron files optional in lxml, + depending on the availability of the RNG validation file. Some lxml + distributions discard the validation schema file due to licensing issues. + +See https://bugs.launchpad.net/lxml/+bug/2024343 +--- + CHANGES.txt | 11 +++++++++++ + doc/validation.txt | 9 +++++++++ + src/lxml/isoschematron/__init__.py | 24 +++++++++++++++++++----- + 3 files changed, 39 insertions(+), 5 deletions(-) + +diff --git a/CHANGES.txt b/CHANGES.txt +index c684ad5..40e32cd 100644 +--- a/CHANGES.txt ++++ b/CHANGES.txt +@@ -2,6 +2,17 @@ + lxml changelog + ============== + ++4.9.2+ ++====== ++ ++* LP#2024343: The validation of the schema file itself is now optional in the ++ ISO-Schematron implementation. This was done because some lxml distributions ++ discard the RNG validation schema file due to licensing issues. The validation ++ can now always be disabled with ``Schematron(..., validate_schema=False)``. ++ It is enabled by default if available and disabled otherwise. The module ++ constant ``lxml.isoschematron.schematron_schema_valid_supported`` can be used ++ to detect whether schema file validation is available. ++ + 4.9.2 (2022-12-13) + ================== + +diff --git a/doc/validation.txt b/doc/validation.txt +index af9d007..27c0ccd 100644 +--- a/doc/validation.txt ++++ b/doc/validation.txt +@@ -615,6 +615,15 @@ The usage of validation phases is a unique feature of ISO-Schematron and can be + a very powerful tool e.g. for establishing validation stages or to provide + different validators for different "validation audiences". + ++Note: Some lxml distributions exclude the validation schema file due to licensing issues. ++Since lxml 4.9.2-8, the validation of the user provided schema can be disabled with ++``Schematron(..., validate_schema=False)``. ++It is enabled by default if available and disabled otherwise. Previous versions of ++lxml always had it enabled and failed at import time if the file was not available. ++Thus, some distributions chose to remove the entire ISO-Schematron support. ++The module constant ``lxml.isoschematron.schematron_schema_valid_supported`` can be used ++since lxml 4.9.2-8 to detect whether schema file validation is available. ++ + (Pre-ISO-Schematron) + -------------------- + +diff --git a/src/lxml/isoschematron/__init__.py b/src/lxml/isoschematron/__init__.py +index 5967b10..2846a66 100644 +--- a/src/lxml/isoschematron/__init__.py ++++ b/src/lxml/isoschematron/__init__.py +@@ -61,10 +61,16 @@ iso_svrl_for_xslt1 = _etree.XSLT(_etree.parse( + svrl_validation_errors = _etree.XPath( + '//svrl:failed-assert', namespaces={'svrl': SVRL_NS}) + +- + # RelaxNG validator for schematron schemas +-schematron_schema_valid = _etree.RelaxNG( +- file=os.path.join(_resources_dir, 'rng', 'iso-schematron.rng')) ++schematron_schema_valid_supported = False ++try: ++ schematron_schema_valid = _etree.RelaxNG( ++ file=os.path.join(_resources_dir, 'rng', 'iso-schematron.rng')) ++ schematron_schema_valid_supported = True ++except _etree.RelaxNGParseError: ++ # Some distributions delete the file due to licensing issues. ++ def schematron_schema_valid(arg): ++ raise NotImplementedError("Validating the ISO schematron requires iso-schematron.rng") + + + def stylesheet_params(**kwargs): +@@ -153,6 +159,13 @@ class Schematron(_etree._Validator): + report document gets stored and can be accessed as the ``validation_report`` + property. + ++ If ``validate_schema`` is set to False, the validation of the schema file ++ itself is disabled. Validation happens by default after building the full ++ schema, unless the schema validation file cannot be found at import time, ++ in which case the validation gets disabled. Some lxml distributions exclude ++ this file due to licensing issues. ISO-Schematron validation can then still ++ be used normally, but the schemas themselves cannot be validated. ++ + Here is a usage example:: + + >>> from lxml import etree +@@ -234,7 +247,8 @@ class Schematron(_etree._Validator): + def __init__(self, etree=None, file=None, include=True, expand=True, + include_params={}, expand_params={}, compile_params={}, + store_schematron=False, store_xslt=False, store_report=False, +- phase=None, error_finder=ASSERTS_ONLY): ++ phase=None, error_finder=ASSERTS_ONLY, ++ validate_schema=schematron_schema_valid_supported): + super(Schematron, self).__init__() + + self._store_report = store_report +@@ -273,7 +287,7 @@ class Schematron(_etree._Validator): + schematron = self._include(schematron, **include_params) + if expand: + schematron = self._expand(schematron, **expand_params) +- if not schematron_schema_valid(schematron): ++ if validate_schema and not schematron_schema_valid(schematron): + raise _etree.SchematronParseError( + "invalid schematron schema: %s" % + schematron_schema_valid.error_log) +-- +2.40.1 + diff --git a/get-lxml-source.sh b/get-lxml-source.sh index 9d79f3a..ae069f1 100755 --- a/get-lxml-source.sh +++ b/get-lxml-source.sh @@ -13,17 +13,16 @@ fi versionedname=lxml-${version} orig_archive=${versionedname}.tar.gz -new_archive=${versionedname}-no-isoschematron.tar.gz +new_archive=${versionedname}-no-isoschematron-rng.tar.gz if [ ! -e ${orig_archive} ]; then wget -N https://files.pythonhosted.org/packages/source/l/lxml/${orig_archive} fi -deleted_module=lxml-${version}/src/lxml/isoschematron/ -deleted_test=lxml-${version}/src/lxml/tests/test_isoschematron.py +deleted_directory=lxml-${version}/src/lxml/isoschematron/resources/rng # tar --delete does not operate on compressed archives, so do # gz decompression explicitly gzip --decompress ${orig_archive} -tar -v --delete -f ${orig_archive//.gz} {$deleted_module,$deleted_test} +tar -v --delete -f ${orig_archive//.gz} ${deleted_directory} gzip -cf ${orig_archive//.gz} > ${new_archive} diff --git a/python-lxml.spec b/python-lxml.spec index ed69d6d..3fd4931 100644 --- a/python-lxml.spec +++ b/python-lxml.spec @@ -1,21 +1,29 @@ Name: python-lxml Version: 4.9.2 -Release: 7%{?dist} +Release: 8%{?dist} Summary: XML processing library combining libxml2/libxslt with the ElementTree API # The lxml project is licensed under BSD-3-Clause # Some code is derived from ElementTree and cElementTree # thus using the MIT-CMU elementtree license -License: BSD-3-Clause AND MIT-CMU +# .xsl schematron files are under the MIT license +License: BSD-3-Clause AND MIT-CMU AND MIT URL: https://github.com/lxml/lxml # We use the get-lxml-source.sh script to generate the tarball -# without the isoschematron submodule as it contains a problematic -# license. +# without the isoschematron RNG validation file under a problematic license. # See: https://gitlab.com/fedora/legal/fedora-license-data/-/issues/154 -Source0: lxml-%{version}-no-isoschematron.tar.gz +Source0: lxml-%{version}-no-isoschematron-rng.tar.gz Source1: get-lxml-source.sh +# Make the validation of ISO-Schematron files optional in lxml, +# depending on the availability of the RNG validation file +# Rebased from https://github.com/lxml/lxml/commit/4bfab2c821961fb4c5ed8a04e329778c9b09a1df +# Will be included in lxml 5.0 +Patch: Make-the-validation-of-ISO-Schematron-files-optional.patch +# Skip test_isoschematron.test_schematron_invalid_schema_empty without the RNG file +Patch: https://github.com/lxml/lxml/pull/380.patch + # Upstream issue: https://bugs.launchpad.net/lxml/+bug/2016939 Patch: Skip-failing-test-test_html_prefix_nsmap.patch @@ -62,11 +70,6 @@ Python 3 version. %prep %autosetup -n lxml-%{version} -p1 -# Remove isoschematron module due to problematic license -sed -i "s/, 'lxml.isoschematron'//" setup.py -# Remove the doctests for it (the documentation is not shipped) -# The command [d]eletes all lines from the first pattern to the second -sed -Ei '/^Schematron$/,/^\(Pre-ISO-Schematron\)$/d' doc/validation.txt # Don't run html5lib tests --without extras %{!?without_extras:rm src/lxml/html/tests/test_html5parser.py} @@ -97,6 +100,10 @@ cp -a build/lib.%{python3_platform}-*/* src/ %doc README.rst %changelog +* Fri Jul 14 2023 Miro Hrončok - 4.9.2-8 +- Bring back the isoschematron submodule, + but without the validation of the schema file itself + * Fri Jun 16 2023 Python Maint - 4.9.2-7 - Rebuilt for Python 3.12 diff --git a/sources b/sources index 2599e86..dcb73a3 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (lxml-4.9.2-no-isoschematron.tar.gz) = 3ee80967dfa69c840a27ad99546727346f8bb058ed64bf93d2aa8959fb3000e78c1227f4b8709d25aaadeb9a4ccdf97a03eb53a1171de8feda93fbeaa15a8b39 +SHA512 (lxml-4.9.2-no-isoschematron-rng.tar.gz) = 7de5a626bb87f2f56f90a3c308199ed79d78796eeb075b5d42df4bccf3606d3fb2e2981fa9206412b675304dd487fce2dfb90b3b3e0793e8d63be2216b325c47 From 4452ba9aa06f5fb8ed38065bdd883dab2f1c95e1 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 21 Jul 2023 11:10:44 +0000 Subject: [PATCH 12/47] Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- python-lxml.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-lxml.spec b/python-lxml.spec index 3fd4931..28a8382 100644 --- a/python-lxml.spec +++ b/python-lxml.spec @@ -1,6 +1,6 @@ Name: python-lxml Version: 4.9.2 -Release: 8%{?dist} +Release: 9%{?dist} Summary: XML processing library combining libxml2/libxslt with the ElementTree API # The lxml project is licensed under BSD-3-Clause @@ -100,6 +100,9 @@ cp -a build/lib.%{python3_platform}-*/* src/ %doc README.rst %changelog +* Fri Jul 21 2023 Fedora Release Engineering - 4.9.2-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + * Fri Jul 14 2023 Miro Hrončok - 4.9.2-8 - Bring back the isoschematron submodule, but without the validation of the schema file itself From 79d3d026da42c9798b32cffab552353ba880b591 Mon Sep 17 00:00:00 2001 From: Lumir Balhar Date: Mon, 17 Jul 2023 14:09:18 +0200 Subject: [PATCH 13/47] Update to 4.9.3 (rhbz#2219811) --- .gitignore | 1 + 07db761f9f.patch | 32 ------------------- ...ion-of-ISO-Schematron-files-optional.patch | 8 ++--- c6b7e621e4.patch | 24 -------------- python-lxml.spec | 11 +++---- sources | 2 +- 6 files changed, 11 insertions(+), 67 deletions(-) delete mode 100644 07db761f9f.patch delete mode 100644 c6b7e621e4.patch diff --git a/.gitignore b/.gitignore index e39c3f5..b381b1f 100644 --- a/.gitignore +++ b/.gitignore @@ -61,3 +61,4 @@ lxml-2.2.7.tar.gz.asc /lxml-4.9.2.tar.gz /lxml-4.9.2-no-isoschematron.tar.gz /lxml-4.9.2-no-isoschematron-rng.tar.gz +/lxml-4.9.3-no-isoschematron-rng.tar.gz diff --git a/07db761f9f.patch b/07db761f9f.patch deleted file mode 100644 index f6070a5..0000000 --- a/07db761f9f.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 07db761f9f027d1814a43686cda6fca26e37a931 Mon Sep 17 00:00:00 2001 -From: Stefan Behnel -Date: Thu, 11 May 2023 10:29:02 +0200 -Subject: [PATCH] Avoid using the deprecated "imp" module. - -Closes https://bugs.launchpad.net/lxml/+bug/2018137 ---- - src/lxml/html/tests/test_html5parser.py | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/src/lxml/html/tests/test_html5parser.py b/src/lxml/html/tests/test_html5parser.py -index 56afe98b7..bcf7f1b12 100644 ---- a/src/lxml/html/tests/test_html5parser.py -+++ b/src/lxml/html/tests/test_html5parser.py -@@ -1,5 +1,4 @@ - import os --import imp - try: - from StringIO import StringIO - except ImportError: # python 3 -@@ -45,7 +44,10 @@ def find_module(self, fullname, path=None): - return None - - def load_module(self, fullname): -- mod = sys.modules.setdefault(fullname, imp.new_module(fullname)) -+ fake_module = object() -+ fake_module.__qualname__ = fullname -+ fake_module.__name__ = fullname.rsplit('.', 1)[-1] -+ mod = sys.modules.setdefault(fullname, fake_module) - mod.__file__, mod.__loader__, mod.__path__ = "", self, [] - mod.__dict__.update(self.mocks[fullname]) - return mod diff --git a/Make-the-validation-of-ISO-Schematron-files-optional.patch b/Make-the-validation-of-ISO-Schematron-files-optional.patch index d07006e..3bc8132 100644 --- a/Make-the-validation-of-ISO-Schematron-files-optional.patch +++ b/Make-the-validation-of-ISO-Schematron-files-optional.patch @@ -1,4 +1,4 @@ -From 4ac96ce046e9f58141bd66639ba8cb1fad9deefb Mon Sep 17 00:00:00 2001 +From a500f721e3b34018f0a86af275427663dc337b5a Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Wed, 12 Jul 2023 16:59:07 +0200 Subject: [PATCH] Make the validation of ISO-Schematron files optional in lxml, @@ -13,14 +13,14 @@ See https://bugs.launchpad.net/lxml/+bug/2024343 3 files changed, 39 insertions(+), 5 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt -index c684ad5..40e32cd 100644 +index 24052db..e68ee9a 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -2,6 +2,17 @@ lxml changelog ============== -+4.9.2+ ++4.9.3+ +====== + +* LP#2024343: The validation of the schema file itself is now optional in the @@ -31,7 +31,7 @@ index c684ad5..40e32cd 100644 + constant ``lxml.isoschematron.schematron_schema_valid_supported`` can be used + to detect whether schema file validation is available. + - 4.9.2 (2022-12-13) + 4.9.3 (2023-07-05) ================== diff --git a/doc/validation.txt b/doc/validation.txt diff --git a/c6b7e621e4.patch b/c6b7e621e4.patch deleted file mode 100644 index fbdb61d..0000000 --- a/c6b7e621e4.patch +++ /dev/null @@ -1,24 +0,0 @@ -From c6b7e621e4696c02bf8f6ea423ffbbf2109748ab Mon Sep 17 00:00:00 2001 -From: Stefan Behnel -Date: Thu, 11 May 2023 10:30:15 +0200 -Subject: [PATCH] Avoid using the deprecated "imp" module. - -Closes https://bugs.launchpad.net/lxml/+bug/2018137 ---- - src/lxml/html/tests/test_html5parser.py | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/src/lxml/html/tests/test_html5parser.py b/src/lxml/html/tests/test_html5parser.py -index bcf7f1b12..57878a5e3 100644 ---- a/src/lxml/html/tests/test_html5parser.py -+++ b/src/lxml/html/tests/test_html5parser.py -@@ -44,7 +44,8 @@ def find_module(self, fullname, path=None): - return None - - def load_module(self, fullname): -- fake_module = object() -+ class Cls: pass -+ fake_module = Cls() - fake_module.__qualname__ = fullname - fake_module.__name__ = fullname.rsplit('.', 1)[-1] - mod = sys.modules.setdefault(fullname, fake_module) diff --git a/python-lxml.spec b/python-lxml.spec index 28a8382..fb91a3a 100644 --- a/python-lxml.spec +++ b/python-lxml.spec @@ -1,6 +1,6 @@ Name: python-lxml -Version: 4.9.2 -Release: 9%{?dist} +Version: 4.9.3 +Release: 1%{?dist} Summary: XML processing library combining libxml2/libxslt with the ElementTree API # The lxml project is licensed under BSD-3-Clause @@ -27,10 +27,6 @@ Patch: https://github.com/lxml/lxml/pull/380.patch # Upstream issue: https://bugs.launchpad.net/lxml/+bug/2016939 Patch: Skip-failing-test-test_html_prefix_nsmap.patch -# Avoid using the deprecated "imp" module (removed in Python 3.12) -Patch: https://github.com/lxml/lxml/commit/07db761f9f.patch -Patch: https://github.com/lxml/lxml/commit/c6b7e621e4.patch - BuildRequires: gcc BuildRequires: libxml2-devel BuildRequires: libxslt-devel @@ -100,6 +96,9 @@ cp -a build/lib.%{python3_platform}-*/* src/ %doc README.rst %changelog +* Fri Jul 21 2023 Lumír Balhar - 4.9.3-1 +- Update to 4.9.3 (rhbz#2219811) + * Fri Jul 21 2023 Fedora Release Engineering - 4.9.2-9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild diff --git a/sources b/sources index dcb73a3..b03cd14 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (lxml-4.9.2-no-isoschematron-rng.tar.gz) = 7de5a626bb87f2f56f90a3c308199ed79d78796eeb075b5d42df4bccf3606d3fb2e2981fa9206412b675304dd487fce2dfb90b3b3e0793e8d63be2216b325c47 +SHA512 (lxml-4.9.3-no-isoschematron-rng.tar.gz) = e3e289ad0aa4bec75fbdee5682d1047c2f98f48f9fd39571175f6a758a10ab2266ed4591bf9dcb65a387ee22cf9de4adac57997dca57b95e0bae07268aff33fe From 9a245c1e0c5bf9fad77390daa54f0668f19c75cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 25 Jul 2023 13:55:24 +0200 Subject: [PATCH 14/47] Pin Cython < 3 at least until we upgrade to lxml 5+ --- python-lxml.spec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python-lxml.spec b/python-lxml.spec index fb91a3a..a2ce417 100644 --- a/python-lxml.spec +++ b/python-lxml.spec @@ -68,6 +68,8 @@ Python 3 version. %autosetup -n lxml-%{version} -p1 # Don't run html5lib tests --without extras %{!?without_extras:rm src/lxml/html/tests/test_html5parser.py} +# lxml 4.9 is not yet ready for Cython 3 +sed -Ei 's/Cython>=([^,]+)/Cython>=\1,<3/' requirements.txt %generate_buildrequires %pyproject_buildrequires -x source%{?with_extras:,cssselect,html5,htmlsoup} From 55f5648cc5b813afc8996ae1cb17d6c2573c54d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Fri, 28 Jul 2023 11:56:41 +0200 Subject: [PATCH 15/47] Fix build with Cython 3 --- ...4b3c6b906d33c5ef1a15f3d5ca5fff600c76.patch | 402 ++++++ ...0cc1cb0cedf8019184aaca805d2a649cd8de.patch | 1088 +++++++++++++++++ python-lxml.spec | 11 +- 3 files changed, 1498 insertions(+), 3 deletions(-) create mode 100644 a03a4b3c6b906d33c5ef1a15f3d5ca5fff600c76.patch create mode 100644 dcbc0cc1cb0cedf8019184aaca805d2a649cd8de.patch diff --git a/a03a4b3c6b906d33c5ef1a15f3d5ca5fff600c76.patch b/a03a4b3c6b906d33c5ef1a15f3d5ca5fff600c76.patch new file mode 100644 index 0000000..bd02346 --- /dev/null +++ b/a03a4b3c6b906d33c5ef1a15f3d5ca5fff600c76.patch @@ -0,0 +1,402 @@ +From a03a4b3c6b906d33c5ef1a15f3d5ca5fff600c76 Mon Sep 17 00:00:00 2001 +From: Stefan Behnel +Date: Fri, 23 Dec 2022 10:46:32 +0100 +Subject: [PATCH] Use "noexcept" modifiers for callback functions and fix some + exception value declaration bugs found by Cython 3.0. + +--- + src/lxml/extensions.pxi | 6 +++--- + src/lxml/includes/tree.pxd | 10 +++++----- + src/lxml/includes/xmlerror.pxd | 4 ++-- + src/lxml/includes/xmlparser.pxd | 24 ++++++++++++------------ + src/lxml/parser.pxi | 10 +++++----- + src/lxml/saxparser.pxi | 26 +++++++++++++------------- + src/lxml/serializer.pxi | 4 ++-- + src/lxml/xmlerror.pxi | 14 +++++++------- + src/lxml/xpath.pxi | 2 +- + 9 files changed, 50 insertions(+), 50 deletions(-) + +diff --git a/src/lxml/extensions.pxi b/src/lxml/extensions.pxi +index 35a321b7a..80e53d7b5 100644 +--- a/src/lxml/extensions.pxi ++++ b/src/lxml/extensions.pxi +@@ -393,7 +393,7 @@ cdef tuple LIBXML2_XPATH_ERROR_MESSAGES = ( + b"?? Unknown error ??\n", + ) + +-cdef void _forwardXPathError(void* c_ctxt, xmlerror.xmlError* c_error) with gil: ++cdef void _forwardXPathError(void* c_ctxt, xmlerror.xmlError* c_error) noexcept with gil: + cdef xmlerror.xmlError error + cdef int xpath_code + if c_error.message is not NULL: +@@ -414,7 +414,7 @@ cdef void _forwardXPathError(void* c_ctxt, xmlerror.xmlError* c_error) with gil: + + (<_BaseContext>c_ctxt)._error_log._receive(&error) + +-cdef void _receiveXPathError(void* c_context, xmlerror.xmlError* error) nogil: ++cdef void _receiveXPathError(void* c_context, xmlerror.xmlError* error) noexcept nogil: + if not __DEBUG: + return + if c_context is NULL: +@@ -851,7 +851,7 @@ cdef void _extension_function_call(_BaseContext context, function, + # lookup the function by name and call it + + cdef void _xpath_function_call(xpath.xmlXPathParserContext* ctxt, +- int nargs) with gil: ++ int nargs) noexcept with gil: + cdef _BaseContext context + cdef xpath.xmlXPathContext* rctxt = ctxt.context + context = <_BaseContext> rctxt.userData +diff --git a/src/lxml/includes/tree.pxd b/src/lxml/includes/tree.pxd +index 03d558a33..312537cbd 100644 +--- a/src/lxml/includes/tree.pxd ++++ b/src/lxml/includes/tree.pxd +@@ -65,7 +65,7 @@ cdef extern from "libxml/chvalid.h" nogil: + + cdef extern from "libxml/hash.h": + ctypedef struct xmlHashTable +- ctypedef void (*xmlHashScanner)(void* payload, void* data, const_xmlChar* name) # may require GIL! ++ ctypedef void (*xmlHashScanner)(void* payload, void* data, const_xmlChar* name) noexcept # may require GIL! + void xmlHashScan(xmlHashTable* table, xmlHashScanner f, void* data) nogil + void* xmlHashLookup(xmlHashTable* table, const_xmlChar* name) nogil + ctypedef void (*xmlHashDeallocator)(void *payload, xmlChar *name) +@@ -411,12 +411,12 @@ cdef extern from "libxml/xmlIO.h": + cdef int xmlOutputBufferClose(xmlOutputBuffer* out) nogil + + ctypedef int (*xmlInputReadCallback)(void* context, +- char* buffer, int len) nogil +- ctypedef int (*xmlInputCloseCallback)(void* context) nogil ++ char* buffer, int len) except -1 nogil ++ ctypedef int (*xmlInputCloseCallback)(void* context) except -1 nogil + + ctypedef int (*xmlOutputWriteCallback)(void* context, +- char* buffer, int len) +- ctypedef int (*xmlOutputCloseCallback)(void* context) ++ char* buffer, int len) except -1 ++ ctypedef int (*xmlOutputCloseCallback)(void* context) except -1 + + cdef xmlOutputBuffer* xmlAllocOutputBuffer( + xmlCharEncodingHandler* encoder) nogil +diff --git a/src/lxml/includes/xmlerror.pxd b/src/lxml/includes/xmlerror.pxd +index c5ac6a0aa..6967378b7 100644 +--- a/src/lxml/includes/xmlerror.pxd ++++ b/src/lxml/includes/xmlerror.pxd +@@ -838,9 +838,9 @@ cdef extern from "libxml/xmlerror.h" nogil: + int int2 + void* node + +- ctypedef void (*xmlGenericErrorFunc)(void* ctxt, char* msg, ...) ++ ctypedef void (*xmlGenericErrorFunc)(void* ctxt, char* msg, ...) noexcept + ctypedef void (*xmlStructuredErrorFunc)(void* userData, +- xmlError* error) ++ xmlError* error) noexcept + + cdef void xmlSetGenericErrorFunc( + void* ctxt, xmlGenericErrorFunc func) +diff --git a/src/lxml/includes/xmlparser.pxd b/src/lxml/includes/xmlparser.pxd +index 9f3056248..c94212cee 100644 +--- a/src/lxml/includes/xmlparser.pxd ++++ b/src/lxml/includes/xmlparser.pxd +@@ -15,37 +15,37 @@ cdef extern from "libxml/parser.h" nogil: + const_xmlChar** namespaces, + int nb_attributes, + int nb_defaulted, +- const_xmlChar** attributes) ++ const_xmlChar** attributes) noexcept + + ctypedef void (*endElementNsSAX2Func)(void* ctx, + const_xmlChar* localname, + const_xmlChar* prefix, +- const_xmlChar* URI) ++ const_xmlChar* URI) noexcept + +- ctypedef void (*startElementSAXFunc)(void* ctx, const_xmlChar* name, const_xmlChar** atts) ++ ctypedef void (*startElementSAXFunc)(void* ctx, const_xmlChar* name, const_xmlChar** atts) noexcept + +- ctypedef void (*endElementSAXFunc)(void* ctx, const_xmlChar* name) ++ ctypedef void (*endElementSAXFunc)(void* ctx, const_xmlChar* name) noexcept + +- ctypedef void (*charactersSAXFunc)(void* ctx, const_xmlChar* ch, int len) ++ ctypedef void (*charactersSAXFunc)(void* ctx, const_xmlChar* ch, int len) noexcept + +- ctypedef void (*cdataBlockSAXFunc)(void* ctx, const_xmlChar* value, int len) ++ ctypedef void (*cdataBlockSAXFunc)(void* ctx, const_xmlChar* value, int len) noexcept + +- ctypedef void (*commentSAXFunc)(void* ctx, const_xmlChar* value) ++ ctypedef void (*commentSAXFunc)(void* ctx, const_xmlChar* value) noexcept + + ctypedef void (*processingInstructionSAXFunc)(void* ctx, + const_xmlChar* target, +- const_xmlChar* data) ++ const_xmlChar* data) noexcept + + ctypedef void (*internalSubsetSAXFunc)(void* ctx, + const_xmlChar* name, + const_xmlChar* externalID, +- const_xmlChar* systemID) ++ const_xmlChar* systemID) noexcept + +- ctypedef void (*endDocumentSAXFunc)(void* ctx) ++ ctypedef void (*endDocumentSAXFunc)(void* ctx) noexcept + +- ctypedef void (*startDocumentSAXFunc)(void* ctx) ++ ctypedef void (*startDocumentSAXFunc)(void* ctx) noexcept + +- ctypedef void (*referenceSAXFunc)(void * ctx, const_xmlChar* name) ++ ctypedef void (*referenceSAXFunc)(void * ctx, const_xmlChar* name) noexcept + + cdef int XML_SAX2_MAGIC + +diff --git a/src/lxml/parser.pxi b/src/lxml/parser.pxi +index f0c8c6b64..e1e9da9f0 100644 +--- a/src/lxml/parser.pxi ++++ b/src/lxml/parser.pxi +@@ -402,10 +402,10 @@ cdef class _FileReaderContext: + finally: + return c_byte_count # swallow any exceptions + +-cdef int _readFilelikeParser(void* ctxt, char* c_buffer, int c_size) with gil: ++cdef int _readFilelikeParser(void* ctxt, char* c_buffer, int c_size) except -1 with gil: + return (<_FileReaderContext>ctxt).copyToBuffer(c_buffer, c_size) + +-cdef int _readFileParser(void* ctxt, char* c_buffer, int c_size) nogil: ++cdef int _readFileParser(void* ctxt, char* c_buffer, int c_size) except -1 nogil: + return stdio.fread(c_buffer, 1, c_size, ctxt) + + ############################################################ +@@ -626,10 +626,10 @@ cdef _initParserContext(_ParserContext context, + if c_ctxt is not NULL: + context._initParserContext(c_ctxt) + +-cdef void _forwardParserError(xmlparser.xmlParserCtxt* _parser_context, xmlerror.xmlError* error) with gil: ++cdef void _forwardParserError(xmlparser.xmlParserCtxt* _parser_context, xmlerror.xmlError* error) noexcept with gil: + (<_ParserContext>_parser_context._private)._error_log._receive(error) + +-cdef void _receiveParserError(void* c_context, xmlerror.xmlError* error) nogil: ++cdef void _receiveParserError(void* c_context, xmlerror.xmlError* error) noexcept nogil: + if __DEBUG: + if c_context is NULL or (c_context)._private is NULL: + _forwardError(NULL, error) +@@ -1207,7 +1207,7 @@ cdef class _BaseParser: + context.cleanup() + + +-cdef void _initSaxDocument(void* ctxt) with gil: ++cdef void _initSaxDocument(void* ctxt) noexcept with gil: + xmlparser.xmlSAX2StartDocument(ctxt) + c_ctxt = ctxt + c_doc = c_ctxt.myDoc +diff --git a/src/lxml/saxparser.pxi b/src/lxml/saxparser.pxi +index 49e72beaf..1737f0801 100644 +--- a/src/lxml/saxparser.pxi ++++ b/src/lxml/saxparser.pxi +@@ -294,7 +294,7 @@ cdef void _handleSaxStart( + const_xmlChar* c_namespace, int c_nb_namespaces, + const_xmlChar** c_namespaces, + int c_nb_attributes, int c_nb_defaulted, +- const_xmlChar** c_attributes) with gil: ++ const_xmlChar** c_attributes) noexcept with gil: + cdef int i + cdef size_t c_len + c_ctxt = ctxt +@@ -336,7 +336,7 @@ cdef void _handleSaxTargetStart( + const_xmlChar* c_namespace, int c_nb_namespaces, + const_xmlChar** c_namespaces, + int c_nb_attributes, int c_nb_defaulted, +- const_xmlChar** c_attributes) with gil: ++ const_xmlChar** c_attributes) noexcept with gil: + cdef int i + cdef size_t c_len + c_ctxt = ctxt +@@ -407,7 +407,7 @@ cdef void _handleSaxTargetStart( + + + cdef void _handleSaxStartNoNs(void* ctxt, const_xmlChar* c_name, +- const_xmlChar** c_attributes) with gil: ++ const_xmlChar** c_attributes) noexcept with gil: + c_ctxt = ctxt + if c_ctxt._private is NULL or c_ctxt.disableSAX: + return +@@ -426,7 +426,7 @@ cdef void _handleSaxStartNoNs(void* ctxt, const_xmlChar* c_name, + + + cdef void _handleSaxTargetStartNoNs(void* ctxt, const_xmlChar* c_name, +- const_xmlChar** c_attributes) with gil: ++ const_xmlChar** c_attributes) noexcept with gil: + c_ctxt = ctxt + if c_ctxt._private is NULL or c_ctxt.disableSAX: + return +@@ -483,7 +483,7 @@ cdef int _pushSaxStartEvent(_SaxParserContext context, + + cdef void _handleSaxEnd(void* ctxt, const_xmlChar* c_localname, + const_xmlChar* c_prefix, +- const_xmlChar* c_namespace) with gil: ++ const_xmlChar* c_namespace) noexcept with gil: + c_ctxt = ctxt + if c_ctxt._private is NULL or c_ctxt.disableSAX: + return +@@ -506,7 +506,7 @@ cdef void _handleSaxEnd(void* ctxt, const_xmlChar* c_localname, + return # swallow any further exceptions + + +-cdef void _handleSaxEndNoNs(void* ctxt, const_xmlChar* c_name) with gil: ++cdef void _handleSaxEndNoNs(void* ctxt, const_xmlChar* c_name) noexcept with gil: + c_ctxt = ctxt + if c_ctxt._private is NULL or c_ctxt.disableSAX: + return +@@ -558,7 +558,7 @@ cdef int _pushSaxEndEvent(_SaxParserContext context, + return 0 + + +-cdef void _handleSaxData(void* ctxt, const_xmlChar* c_data, int data_len) with gil: ++cdef void _handleSaxData(void* ctxt, const_xmlChar* c_data, int data_len) noexcept with gil: + # can only be called if parsing with a target + c_ctxt = ctxt + if c_ctxt._private is NULL or c_ctxt.disableSAX: +@@ -575,7 +575,7 @@ cdef void _handleSaxData(void* ctxt, const_xmlChar* c_data, int data_len) with g + + cdef void _handleSaxTargetDoctype(void* ctxt, const_xmlChar* c_name, + const_xmlChar* c_public, +- const_xmlChar* c_system) with gil: ++ const_xmlChar* c_system) noexcept with gil: + # can only be called if parsing with a target + c_ctxt = ctxt + if c_ctxt._private is NULL or c_ctxt.disableSAX: +@@ -592,7 +592,7 @@ cdef void _handleSaxTargetDoctype(void* ctxt, const_xmlChar* c_name, + return # swallow any further exceptions + + +-cdef void _handleSaxStartDocument(void* ctxt) with gil: ++cdef void _handleSaxStartDocument(void* ctxt) noexcept with gil: + c_ctxt = ctxt + if c_ctxt._private is NULL or c_ctxt.disableSAX: + return +@@ -608,7 +608,7 @@ cdef void _handleSaxStartDocument(void* ctxt) with gil: + + + cdef void _handleSaxTargetPI(void* ctxt, const_xmlChar* c_target, +- const_xmlChar* c_data) with gil: ++ const_xmlChar* c_data) noexcept with gil: + # can only be called if parsing with a target + c_ctxt = ctxt + if c_ctxt._private is NULL or c_ctxt.disableSAX: +@@ -627,7 +627,7 @@ cdef void _handleSaxTargetPI(void* ctxt, const_xmlChar* c_target, + + + cdef void _handleSaxPIEvent(void* ctxt, const_xmlChar* target, +- const_xmlChar* data) with gil: ++ const_xmlChar* data) noexcept with gil: + # can only be called when collecting pi events + c_ctxt = ctxt + if c_ctxt._private is NULL or c_ctxt.disableSAX: +@@ -645,7 +645,7 @@ cdef void _handleSaxPIEvent(void* ctxt, const_xmlChar* target, + return # swallow any further exceptions + + +-cdef void _handleSaxTargetComment(void* ctxt, const_xmlChar* c_data) with gil: ++cdef void _handleSaxTargetComment(void* ctxt, const_xmlChar* c_data) noexcept with gil: + # can only be called if parsing with a target + c_ctxt = ctxt + if c_ctxt._private is NULL or c_ctxt.disableSAX: +@@ -661,7 +661,7 @@ cdef void _handleSaxTargetComment(void* ctxt, const_xmlChar* c_data) with gil: + return # swallow any further exceptions + + +-cdef void _handleSaxComment(void* ctxt, const_xmlChar* text) with gil: ++cdef void _handleSaxComment(void* ctxt, const_xmlChar* text) noexcept with gil: + # can only be called when collecting comment events + c_ctxt = ctxt + if c_ctxt._private is NULL or c_ctxt.disableSAX: +diff --git a/src/lxml/serializer.pxi b/src/lxml/serializer.pxi +index 79a02829e..e1c76e1ba 100644 +--- a/src/lxml/serializer.pxi ++++ b/src/lxml/serializer.pxi +@@ -699,10 +699,10 @@ cdef class _FilelikeWriter: + finally: + return retval # and swallow any further exceptions + +-cdef int _writeFilelikeWriter(void* ctxt, char* c_buffer, int length): ++cdef int _writeFilelikeWriter(void* ctxt, char* c_buffer, int length) except -1: + return (<_FilelikeWriter>ctxt).write(c_buffer, length) + +-cdef int _closeFilelikeWriter(void* ctxt): ++cdef int _closeFilelikeWriter(void* ctxt) except -1: + return (<_FilelikeWriter>ctxt).close() + + cdef _tofilelike(f, _Element element, encoding, doctype, method, +diff --git a/src/lxml/xmlerror.pxi b/src/lxml/xmlerror.pxi +index 1b50444fb..793e1d923 100644 +--- a/src/lxml/xmlerror.pxi ++++ b/src/lxml/xmlerror.pxi +@@ -634,7 +634,7 @@ def use_global_python_log(PyErrorLog log not None): + + + # local log functions: forward error to logger object +-cdef void _forwardError(void* c_log_handler, xmlerror.xmlError* error) with gil: ++cdef void _forwardError(void* c_log_handler, xmlerror.xmlError* error) noexcept with gil: + cdef _BaseErrorLog log_handler + if c_log_handler is not NULL: + log_handler = <_BaseErrorLog>c_log_handler +@@ -645,27 +645,27 @@ cdef void _forwardError(void* c_log_handler, xmlerror.xmlError* error) with gil: + log_handler._receive(error) + + +-cdef void _receiveError(void* c_log_handler, xmlerror.xmlError* error) nogil: ++cdef void _receiveError(void* c_log_handler, xmlerror.xmlError* error) noexcept nogil: + # no Python objects here, may be called without thread context ! + if __DEBUG: + _forwardError(c_log_handler, error) + + +-cdef void _receiveXSLTError(void* c_log_handler, char* msg, ...) nogil: ++cdef void _receiveXSLTError(void* c_log_handler, char* msg, ...) noexcept nogil: + # no Python objects here, may be called without thread context ! + cdef cvarargs.va_list args + cvarargs.va_start(args, msg) + _receiveGenericError(c_log_handler, xmlerror.XML_FROM_XSLT, msg, args) + cvarargs.va_end(args) + +-cdef void _receiveRelaxNGParseError(void* c_log_handler, char* msg, ...) nogil: ++cdef void _receiveRelaxNGParseError(void* c_log_handler, char* msg, ...) noexcept nogil: + # no Python objects here, may be called without thread context ! + cdef cvarargs.va_list args + cvarargs.va_start(args, msg) + _receiveGenericError(c_log_handler, xmlerror.XML_FROM_RELAXNGP, msg, args) + cvarargs.va_end(args) + +-cdef void _receiveRelaxNGValidationError(void* c_log_handler, char* msg, ...) nogil: ++cdef void _receiveRelaxNGValidationError(void* c_log_handler, char* msg, ...) noexcept nogil: + # no Python objects here, may be called without thread context ! + cdef cvarargs.va_list args + cvarargs.va_start(args, msg) +@@ -673,7 +673,7 @@ cdef void _receiveRelaxNGValidationError(void* c_log_handler, char* msg, ...) no + cvarargs.va_end(args) + + # dummy function: no log output at all +-cdef void _nullGenericErrorFunc(void* ctxt, char* msg, ...) nogil: ++cdef void _nullGenericErrorFunc(void* ctxt, char* msg, ...) noexcept nogil: + pass + + +@@ -694,7 +694,7 @@ cdef void _connectGenericErrorLog(log, int c_domain=-1): + + + cdef void _receiveGenericError(void* c_log_handler, int c_domain, +- char* msg, cvarargs.va_list args) nogil: ++ char* msg, cvarargs.va_list args) noexcept nogil: + # no Python objects here, may be called without thread context ! + cdef xmlerror.xmlError c_error + cdef char* c_text +diff --git a/src/lxml/xpath.pxi b/src/lxml/xpath.pxi +index a7cae4bff..704338e89 100644 +--- a/src/lxml/xpath.pxi ++++ b/src/lxml/xpath.pxi +@@ -99,7 +99,7 @@ cdef class _XPathContext(_BaseContext): + + + cdef void _registerExsltFunctionsForNamespaces( +- void* _c_href, void* _ctxt, const_xmlChar* c_prefix): ++ void* _c_href, void* _ctxt, const_xmlChar* c_prefix) noexcept: + c_href = _c_href + ctxt = _ctxt + diff --git a/dcbc0cc1cb0cedf8019184aaca805d2a649cd8de.patch b/dcbc0cc1cb0cedf8019184aaca805d2a649cd8de.patch new file mode 100644 index 0000000..8de9737 --- /dev/null +++ b/dcbc0cc1cb0cedf8019184aaca805d2a649cd8de.patch @@ -0,0 +1,1088 @@ +From dcbc0cc1cb0cedf8019184aaca805d2a649cd8de Mon Sep 17 00:00:00 2001 +From: Stefan Behnel +Date: Thu, 15 Dec 2022 11:38:42 +0100 +Subject: [PATCH] Use generic 'nogil' block markers in pxd declarations where + possible, except for a few callback declarations that may be used for regular + GIL functions. + +--- + src/lxml/includes/c14n.pxd | 9 +- + src/lxml/includes/htmlparser.pxd | 26 ++-- + src/lxml/includes/relaxng.pxd | 22 +-- + src/lxml/includes/schematron.pxd | 16 +- + src/lxml/includes/tree.pxd | 260 +++++++++++++++---------------- + src/lxml/includes/uri.pxd | 2 +- + src/lxml/includes/xinclude.pxd | 20 +-- + src/lxml/includes/xmlerror.pxd | 12 +- + src/lxml/includes/xmlparser.pxd | 67 ++++---- + src/lxml/includes/xmlschema.pxd | 2 +- + src/lxml/includes/xpath.pxd | 73 ++++----- + src/lxml/includes/xslt.pxd | 85 +++++----- + 12 files changed, 297 insertions(+), 297 deletions(-) + +diff --git a/src/lxml/includes/c14n.pxd b/src/lxml/includes/c14n.pxd +index d075e90e2..8b1f3c4c5 100644 +--- a/src/lxml/includes/c14n.pxd ++++ b/src/lxml/includes/c14n.pxd +@@ -1,13 +1,13 @@ + from lxml.includes.tree cimport xmlDoc, xmlOutputBuffer, xmlChar + from lxml.includes.xpath cimport xmlNodeSet + +-cdef extern from "libxml/c14n.h": ++cdef extern from "libxml/c14n.h" nogil: + cdef int xmlC14NDocDumpMemory(xmlDoc* doc, + xmlNodeSet* nodes, + int exclusive, + xmlChar** inclusive_ns_prefixes, + int with_comments, +- xmlChar** doc_txt_ptr) nogil ++ xmlChar** doc_txt_ptr) + + cdef int xmlC14NDocSave(xmlDoc* doc, + xmlNodeSet* nodes, +@@ -15,12 +15,11 @@ cdef extern from "libxml/c14n.h": + xmlChar** inclusive_ns_prefixes, + int with_comments, + char* filename, +- int compression) nogil ++ int compression) + + cdef int xmlC14NDocSaveTo(xmlDoc* doc, + xmlNodeSet* nodes, + int exclusive, + xmlChar** inclusive_ns_prefixes, + int with_comments, +- xmlOutputBuffer* buffer) nogil +- ++ xmlOutputBuffer* buffer) +diff --git a/src/lxml/includes/htmlparser.pxd b/src/lxml/includes/htmlparser.pxd +index 145a69a06..31dcc406c 100644 +--- a/src/lxml/includes/htmlparser.pxd ++++ b/src/lxml/includes/htmlparser.pxd +@@ -4,7 +4,7 @@ from lxml.includes.tree cimport xmlDoc + from lxml.includes.tree cimport xmlInputReadCallback, xmlInputCloseCallback + from lxml.includes.xmlparser cimport xmlParserCtxt, xmlSAXHandler, xmlSAXHandlerV1 + +-cdef extern from "libxml/HTMLparser.h": ++cdef extern from "libxml/HTMLparser.h" nogil: + ctypedef enum htmlParserOption: + HTML_PARSE_NOERROR # suppress error reports + HTML_PARSE_NOWARNING # suppress warning reports +@@ -24,33 +24,33 @@ cdef extern from "libxml/HTMLparser.h": + xmlSAXHandlerV1 htmlDefaultSAXHandler + + cdef xmlParserCtxt* htmlCreateMemoryParserCtxt( +- char* buffer, int size) nogil ++ char* buffer, int size) + cdef xmlParserCtxt* htmlCreateFileParserCtxt( +- char* filename, char* encoding) nogil ++ char* filename, char* encoding) + cdef xmlParserCtxt* htmlCreatePushParserCtxt(xmlSAXHandler* sax, + void* user_data, + char* chunk, int size, +- char* filename, int enc) nogil +- cdef void htmlFreeParserCtxt(xmlParserCtxt* ctxt) nogil +- cdef void htmlCtxtReset(xmlParserCtxt* ctxt) nogil +- cdef int htmlCtxtUseOptions(xmlParserCtxt* ctxt, int options) nogil +- cdef int htmlParseDocument(xmlParserCtxt* ctxt) nogil ++ char* filename, int enc) ++ cdef void htmlFreeParserCtxt(xmlParserCtxt* ctxt) ++ cdef void htmlCtxtReset(xmlParserCtxt* ctxt) ++ cdef int htmlCtxtUseOptions(xmlParserCtxt* ctxt, int options) ++ cdef int htmlParseDocument(xmlParserCtxt* ctxt) + cdef int htmlParseChunk(xmlParserCtxt* ctxt, +- char* chunk, int size, int terminate) nogil ++ char* chunk, int size, int terminate) + + cdef xmlDoc* htmlCtxtReadFile(xmlParserCtxt* ctxt, + char* filename, const_char* encoding, +- int options) nogil ++ int options) + cdef xmlDoc* htmlCtxtReadDoc(xmlParserCtxt* ctxt, + char* buffer, char* URL, const_char* encoding, +- int options) nogil ++ int options) + cdef xmlDoc* htmlCtxtReadIO(xmlParserCtxt* ctxt, + xmlInputReadCallback ioread, + xmlInputCloseCallback ioclose, + void* ioctx, + char* URL, const_char* encoding, +- int options) nogil ++ int options) + cdef xmlDoc* htmlCtxtReadMemory(xmlParserCtxt* ctxt, + char* buffer, int size, + char* filename, const_char* encoding, +- int options) nogil ++ int options) +diff --git a/src/lxml/includes/relaxng.pxd b/src/lxml/includes/relaxng.pxd +index 28e9212d2..5ac96711e 100644 +--- a/src/lxml/includes/relaxng.pxd ++++ b/src/lxml/includes/relaxng.pxd +@@ -1,7 +1,7 @@ + from lxml.includes.tree cimport xmlDoc + from lxml.includes.xmlerror cimport xmlStructuredErrorFunc + +-cdef extern from "libxml/relaxng.h": ++cdef extern from "libxml/relaxng.h" nogil: + ctypedef struct xmlRelaxNG + ctypedef struct xmlRelaxNGParserCtxt + +@@ -49,16 +49,16 @@ cdef extern from "libxml/relaxng.h": + XML_RELAXNG_ERR_ELEMWRONG = 38 + XML_RELAXNG_ERR_TEXTWRONG = 39 + +- cdef xmlRelaxNGValidCtxt* xmlRelaxNGNewValidCtxt(xmlRelaxNG* schema) nogil +- cdef int xmlRelaxNGValidateDoc(xmlRelaxNGValidCtxt* ctxt, xmlDoc* doc) nogil +- cdef xmlRelaxNG* xmlRelaxNGParse(xmlRelaxNGParserCtxt* ctxt) nogil +- cdef xmlRelaxNGParserCtxt* xmlRelaxNGNewParserCtxt(char* URL) nogil +- cdef xmlRelaxNGParserCtxt* xmlRelaxNGNewDocParserCtxt(xmlDoc* doc) nogil +- cdef void xmlRelaxNGFree(xmlRelaxNG* schema) nogil +- cdef void xmlRelaxNGFreeParserCtxt(xmlRelaxNGParserCtxt* ctxt) nogil +- cdef void xmlRelaxNGFreeValidCtxt(xmlRelaxNGValidCtxt* ctxt) nogil ++ cdef xmlRelaxNGValidCtxt* xmlRelaxNGNewValidCtxt(xmlRelaxNG* schema) ++ cdef int xmlRelaxNGValidateDoc(xmlRelaxNGValidCtxt* ctxt, xmlDoc* doc) ++ cdef xmlRelaxNG* xmlRelaxNGParse(xmlRelaxNGParserCtxt* ctxt) ++ cdef xmlRelaxNGParserCtxt* xmlRelaxNGNewParserCtxt(char* URL) ++ cdef xmlRelaxNGParserCtxt* xmlRelaxNGNewDocParserCtxt(xmlDoc* doc) ++ cdef void xmlRelaxNGFree(xmlRelaxNG* schema) ++ cdef void xmlRelaxNGFreeParserCtxt(xmlRelaxNGParserCtxt* ctxt) ++ cdef void xmlRelaxNGFreeValidCtxt(xmlRelaxNGValidCtxt* ctxt) + + cdef void xmlRelaxNGSetValidStructuredErrors( +- xmlRelaxNGValidCtxt* ctxt, xmlStructuredErrorFunc serror, void *ctx) nogil ++ xmlRelaxNGValidCtxt* ctxt, xmlStructuredErrorFunc serror, void *ctx) + cdef void xmlRelaxNGSetParserStructuredErrors( +- xmlRelaxNGParserCtxt* ctxt, xmlStructuredErrorFunc serror, void *ctx) nogil ++ xmlRelaxNGParserCtxt* ctxt, xmlStructuredErrorFunc serror, void *ctx) +diff --git a/src/lxml/includes/schematron.pxd b/src/lxml/includes/schematron.pxd +index f8e325284..181248afd 100644 +--- a/src/lxml/includes/schematron.pxd ++++ b/src/lxml/includes/schematron.pxd +@@ -1,7 +1,7 @@ + from lxml.includes cimport xmlerror + from lxml.includes.tree cimport xmlDoc + +-cdef extern from "libxml/schematron.h": ++cdef extern from "libxml/schematron.h" nogil: + ctypedef struct xmlSchematron + ctypedef struct xmlSchematronParserCtxt + ctypedef struct xmlSchematronValidCtxt +@@ -16,19 +16,19 @@ cdef extern from "libxml/schematron.h": + XML_SCHEMATRON_OUT_IO = 1024 # output to I/O mechanism + + cdef xmlSchematronParserCtxt* xmlSchematronNewDocParserCtxt( +- xmlDoc* doc) nogil ++ xmlDoc* doc) + cdef xmlSchematronParserCtxt* xmlSchematronNewParserCtxt( + char* filename) nogil + cdef xmlSchematronValidCtxt* xmlSchematronNewValidCtxt( +- xmlSchematron* schema, int options) nogil ++ xmlSchematron* schema, int options) + +- cdef xmlSchematron* xmlSchematronParse(xmlSchematronParserCtxt* ctxt) nogil ++ cdef xmlSchematron* xmlSchematronParse(xmlSchematronParserCtxt* ctxt) + cdef int xmlSchematronValidateDoc(xmlSchematronValidCtxt* ctxt, +- xmlDoc* instance) nogil ++ xmlDoc* instance) + +- cdef void xmlSchematronFreeParserCtxt(xmlSchematronParserCtxt* ctxt) nogil +- cdef void xmlSchematronFreeValidCtxt(xmlSchematronValidCtxt* ctxt) nogil +- cdef void xmlSchematronFree(xmlSchematron* schema) nogil ++ cdef void xmlSchematronFreeParserCtxt(xmlSchematronParserCtxt* ctxt) ++ cdef void xmlSchematronFreeValidCtxt(xmlSchematronValidCtxt* ctxt) ++ cdef void xmlSchematronFree(xmlSchematron* schema) + cdef void xmlSchematronSetValidStructuredErrors( + xmlSchematronValidCtxt* ctxt, + xmlerror.xmlStructuredErrorFunc error_func, void *data) +diff --git a/src/lxml/includes/tree.pxd b/src/lxml/includes/tree.pxd +index 010af8090..03d558a33 100644 +--- a/src/lxml/includes/tree.pxd ++++ b/src/lxml/includes/tree.pxd +@@ -9,19 +9,19 @@ cdef extern from "libxml/xmlversion.h": + cdef const_char* xmlParserVersion + cdef int LIBXML_VERSION + +-cdef extern from "libxml/xmlstring.h": ++cdef extern from "libxml/xmlstring.h" nogil: + ctypedef unsigned char xmlChar + ctypedef const xmlChar const_xmlChar "const xmlChar" +- cdef int xmlStrlen(const_xmlChar* str) nogil +- cdef xmlChar* xmlStrdup(const_xmlChar* cur) nogil +- cdef int xmlStrncmp(const_xmlChar* str1, const_xmlChar* str2, int length) nogil +- cdef int xmlStrcmp(const_xmlChar* str1, const_xmlChar* str2) nogil +- cdef int xmlStrcasecmp(const xmlChar *str1, const xmlChar *str2) nogil +- cdef const_xmlChar* xmlStrstr(const_xmlChar* str1, const_xmlChar* str2) nogil +- cdef const_xmlChar* xmlStrchr(const_xmlChar* str1, xmlChar ch) nogil ++ cdef int xmlStrlen(const_xmlChar* str) ++ cdef xmlChar* xmlStrdup(const_xmlChar* cur) ++ cdef int xmlStrncmp(const_xmlChar* str1, const_xmlChar* str2, int length) ++ cdef int xmlStrcmp(const_xmlChar* str1, const_xmlChar* str2) ++ cdef int xmlStrcasecmp(const xmlChar *str1, const xmlChar *str2) ++ cdef const_xmlChar* xmlStrstr(const_xmlChar* str1, const_xmlChar* str2) ++ cdef const_xmlChar* xmlStrchr(const_xmlChar* str1, xmlChar ch) + cdef const_xmlChar* _xcstr "(const xmlChar*)PyBytes_AS_STRING" (object s) + +-cdef extern from "libxml/encoding.h": ++cdef extern from "libxml/encoding.h" nogil: + ctypedef enum xmlCharEncoding: + XML_CHAR_ENCODING_ERROR = -1 # No char encoding detected + XML_CHAR_ENCODING_NONE = 0 # No char encoding detected +@@ -49,19 +49,19 @@ cdef extern from "libxml/encoding.h": + XML_CHAR_ENCODING_ASCII = 22 # pure ASCII + + ctypedef struct xmlCharEncodingHandler +- cdef xmlCharEncodingHandler* xmlFindCharEncodingHandler(char* name) nogil ++ cdef xmlCharEncodingHandler* xmlFindCharEncodingHandler(char* name) + cdef xmlCharEncodingHandler* xmlGetCharEncodingHandler( +- xmlCharEncoding enc) nogil +- cdef int xmlCharEncCloseFunc(xmlCharEncodingHandler* handler) nogil +- cdef xmlCharEncoding xmlDetectCharEncoding(const_xmlChar* text, int len) nogil +- cdef const_char* xmlGetCharEncodingName(xmlCharEncoding enc) nogil +- cdef xmlCharEncoding xmlParseCharEncoding(char* name) nogil ++ xmlCharEncoding enc) ++ cdef int xmlCharEncCloseFunc(xmlCharEncodingHandler* handler) ++ cdef xmlCharEncoding xmlDetectCharEncoding(const_xmlChar* text, int len) ++ cdef const_char* xmlGetCharEncodingName(xmlCharEncoding enc) ++ cdef xmlCharEncoding xmlParseCharEncoding(char* name) + ctypedef int (*xmlCharEncodingOutputFunc)( + unsigned char *out_buf, int *outlen, const_uchar *in_buf, int *inlen) + +-cdef extern from "libxml/chvalid.h": +- cdef int xmlIsChar_ch(char c) nogil +- cdef int xmlIsCharQ(int ch) nogil ++cdef extern from "libxml/chvalid.h" nogil: ++ cdef int xmlIsChar_ch(char c) ++ cdef int xmlIsCharQ(int ch) + + cdef extern from "libxml/hash.h": + ctypedef struct xmlHashTable +@@ -69,20 +69,20 @@ cdef extern from "libxml/hash.h": + void xmlHashScan(xmlHashTable* table, xmlHashScanner f, void* data) nogil + void* xmlHashLookup(xmlHashTable* table, const_xmlChar* name) nogil + ctypedef void (*xmlHashDeallocator)(void *payload, xmlChar *name) +- cdef xmlHashTable* xmlHashCreate(int size) +- cdef xmlHashTable* xmlHashCreateDict(int size, xmlDict *dict) +- cdef int xmlHashSize(xmlHashTable* table) +- cdef void xmlHashFree(xmlHashTable* table, xmlHashDeallocator f) ++ cdef xmlHashTable* xmlHashCreate(int size) nogil ++ cdef xmlHashTable* xmlHashCreateDict(int size, xmlDict *dict) nogil ++ cdef int xmlHashSize(xmlHashTable* table) nogil ++ cdef void xmlHashFree(xmlHashTable* table, xmlHashDeallocator f) nogil + +-cdef extern from *: # actually "libxml/dict.h" ++cdef extern from * nogil: # actually "libxml/dict.h" + # libxml/dict.h appears to be broken to include in C + ctypedef struct xmlDict +- cdef const_xmlChar* xmlDictLookup(xmlDict* dict, const_xmlChar* name, int len) nogil +- cdef const_xmlChar* xmlDictExists(xmlDict* dict, const_xmlChar* name, int len) nogil +- cdef int xmlDictOwns(xmlDict* dict, const_xmlChar* name) nogil +- cdef size_t xmlDictSize(xmlDict* dict) nogil ++ cdef const_xmlChar* xmlDictLookup(xmlDict* dict, const_xmlChar* name, int len) ++ cdef const_xmlChar* xmlDictExists(xmlDict* dict, const_xmlChar* name, int len) ++ cdef int xmlDictOwns(xmlDict* dict, const_xmlChar* name) ++ cdef size_t xmlDictSize(xmlDict* dict) + +-cdef extern from "libxml/tree.h": ++cdef extern from "libxml/tree.h" nogil: + ctypedef struct xmlDoc + ctypedef struct xmlAttr + ctypedef struct xmlNotationTable +@@ -305,100 +305,100 @@ cdef extern from "libxml/tree.h": + + const_xmlChar* XML_XML_NAMESPACE + +- cdef void xmlFreeDoc(xmlDoc* cur) nogil +- cdef void xmlFreeDtd(xmlDtd* cur) nogil +- cdef void xmlFreeNode(xmlNode* cur) nogil +- cdef void xmlFreeNsList(xmlNs* ns) nogil +- cdef void xmlFreeNs(xmlNs* ns) nogil +- cdef void xmlFree(void* buf) nogil ++ cdef void xmlFreeDoc(xmlDoc* cur) ++ cdef void xmlFreeDtd(xmlDtd* cur) ++ cdef void xmlFreeNode(xmlNode* cur) ++ cdef void xmlFreeNsList(xmlNs* ns) ++ cdef void xmlFreeNs(xmlNs* ns) ++ cdef void xmlFree(void* buf) + +- cdef xmlNode* xmlNewNode(xmlNs* ns, const_xmlChar* name) nogil +- cdef xmlNode* xmlNewDocText(xmlDoc* doc, const_xmlChar* content) nogil +- cdef xmlNode* xmlNewDocComment(xmlDoc* doc, const_xmlChar* content) nogil +- cdef xmlNode* xmlNewDocPI(xmlDoc* doc, const_xmlChar* name, const_xmlChar* content) nogil +- cdef xmlNode* xmlNewReference(xmlDoc* doc, const_xmlChar* name) nogil +- cdef xmlNode* xmlNewCDataBlock(xmlDoc* doc, const_xmlChar* text, int len) nogil +- cdef xmlNs* xmlNewNs(xmlNode* node, const_xmlChar* href, const_xmlChar* prefix) nogil +- cdef xmlNode* xmlAddChild(xmlNode* parent, xmlNode* cur) nogil +- cdef xmlNode* xmlReplaceNode(xmlNode* old, xmlNode* cur) nogil +- cdef xmlNode* xmlAddPrevSibling(xmlNode* cur, xmlNode* elem) nogil +- cdef xmlNode* xmlAddNextSibling(xmlNode* cur, xmlNode* elem) nogil ++ cdef xmlNode* xmlNewNode(xmlNs* ns, const_xmlChar* name) ++ cdef xmlNode* xmlNewDocText(xmlDoc* doc, const_xmlChar* content) ++ cdef xmlNode* xmlNewDocComment(xmlDoc* doc, const_xmlChar* content) ++ cdef xmlNode* xmlNewDocPI(xmlDoc* doc, const_xmlChar* name, const_xmlChar* content) ++ cdef xmlNode* xmlNewReference(xmlDoc* doc, const_xmlChar* name) ++ cdef xmlNode* xmlNewCDataBlock(xmlDoc* doc, const_xmlChar* text, int len) ++ cdef xmlNs* xmlNewNs(xmlNode* node, const_xmlChar* href, const_xmlChar* prefix) ++ cdef xmlNode* xmlAddChild(xmlNode* parent, xmlNode* cur) ++ cdef xmlNode* xmlReplaceNode(xmlNode* old, xmlNode* cur) ++ cdef xmlNode* xmlAddPrevSibling(xmlNode* cur, xmlNode* elem) ++ cdef xmlNode* xmlAddNextSibling(xmlNode* cur, xmlNode* elem) + cdef xmlNode* xmlNewDocNode(xmlDoc* doc, xmlNs* ns, +- const_xmlChar* name, const_xmlChar* content) nogil +- cdef xmlDoc* xmlNewDoc(const_xmlChar* version) nogil +- cdef xmlAttr* xmlNewProp(xmlNode* node, const_xmlChar* name, const_xmlChar* value) nogil ++ const_xmlChar* name, const_xmlChar* content) ++ cdef xmlDoc* xmlNewDoc(const_xmlChar* version) ++ cdef xmlAttr* xmlNewProp(xmlNode* node, const_xmlChar* name, const_xmlChar* value) + cdef xmlAttr* xmlNewNsProp(xmlNode* node, xmlNs* ns, +- const_xmlChar* name, const_xmlChar* value) nogil +- cdef xmlChar* xmlGetNoNsProp(xmlNode* node, const_xmlChar* name) nogil +- cdef xmlChar* xmlGetNsProp(xmlNode* node, const_xmlChar* name, const_xmlChar* nameSpace) nogil +- cdef void xmlSetNs(xmlNode* node, xmlNs* ns) nogil +- cdef xmlAttr* xmlSetProp(xmlNode* node, const_xmlChar* name, const_xmlChar* value) nogil ++ const_xmlChar* name, const_xmlChar* value) ++ cdef xmlChar* xmlGetNoNsProp(xmlNode* node, const_xmlChar* name) ++ cdef xmlChar* xmlGetNsProp(xmlNode* node, const_xmlChar* name, const_xmlChar* nameSpace) ++ cdef void xmlSetNs(xmlNode* node, xmlNs* ns) ++ cdef xmlAttr* xmlSetProp(xmlNode* node, const_xmlChar* name, const_xmlChar* value) + cdef xmlAttr* xmlSetNsProp(xmlNode* node, xmlNs* ns, +- const_xmlChar* name, const_xmlChar* value) nogil +- cdef int xmlRemoveID(xmlDoc* doc, xmlAttr* cur) nogil +- cdef int xmlRemoveProp(xmlAttr* cur) nogil +- cdef void xmlFreePropList(xmlAttr* cur) nogil +- cdef xmlChar* xmlGetNodePath(xmlNode* node) nogil +- cdef void xmlDocDumpMemory(xmlDoc* cur, char** mem, int* size) nogil ++ const_xmlChar* name, const_xmlChar* value) ++ cdef int xmlRemoveID(xmlDoc* doc, xmlAttr* cur) ++ cdef int xmlRemoveProp(xmlAttr* cur) ++ cdef void xmlFreePropList(xmlAttr* cur) ++ cdef xmlChar* xmlGetNodePath(xmlNode* node) ++ cdef void xmlDocDumpMemory(xmlDoc* cur, char** mem, int* size) + cdef void xmlDocDumpMemoryEnc(xmlDoc* cur, char** mem, int* size, +- char* encoding) nogil ++ char* encoding) + cdef int xmlSaveFileTo(xmlOutputBuffer* out, xmlDoc* cur, +- char* encoding) nogil +- +- cdef void xmlUnlinkNode(xmlNode* cur) nogil +- cdef xmlNode* xmlDocSetRootElement(xmlDoc* doc, xmlNode* root) nogil +- cdef xmlNode* xmlDocGetRootElement(xmlDoc* doc) nogil +- cdef void xmlSetTreeDoc(xmlNode* tree, xmlDoc* doc) nogil +- cdef xmlAttr* xmlHasProp(xmlNode* node, const_xmlChar* name) nogil +- cdef xmlAttr* xmlHasNsProp(xmlNode* node, const_xmlChar* name, const_xmlChar* nameSpace) nogil +- cdef xmlChar* xmlNodeGetContent(xmlNode* cur) nogil +- cdef int xmlNodeBufGetContent(xmlBuffer* buffer, xmlNode* cur) nogil +- cdef xmlNs* xmlSearchNs(xmlDoc* doc, xmlNode* node, const_xmlChar* prefix) nogil +- cdef xmlNs* xmlSearchNsByHref(xmlDoc* doc, xmlNode* node, const_xmlChar* href) nogil +- cdef int xmlIsBlankNode(xmlNode* node) nogil +- cdef long xmlGetLineNo(xmlNode* node) nogil +- cdef void xmlElemDump(stdio.FILE* f, xmlDoc* doc, xmlNode* cur) nogil ++ char* encoding) ++ ++ cdef void xmlUnlinkNode(xmlNode* cur) ++ cdef xmlNode* xmlDocSetRootElement(xmlDoc* doc, xmlNode* root) ++ cdef xmlNode* xmlDocGetRootElement(xmlDoc* doc) ++ cdef void xmlSetTreeDoc(xmlNode* tree, xmlDoc* doc) ++ cdef xmlAttr* xmlHasProp(xmlNode* node, const_xmlChar* name) ++ cdef xmlAttr* xmlHasNsProp(xmlNode* node, const_xmlChar* name, const_xmlChar* nameSpace) ++ cdef xmlChar* xmlNodeGetContent(xmlNode* cur) ++ cdef int xmlNodeBufGetContent(xmlBuffer* buffer, xmlNode* cur) ++ cdef xmlNs* xmlSearchNs(xmlDoc* doc, xmlNode* node, const_xmlChar* prefix) ++ cdef xmlNs* xmlSearchNsByHref(xmlDoc* doc, xmlNode* node, const_xmlChar* href) ++ cdef int xmlIsBlankNode(xmlNode* node) ++ cdef long xmlGetLineNo(xmlNode* node) ++ cdef void xmlElemDump(stdio.FILE* f, xmlDoc* doc, xmlNode* cur) + cdef void xmlNodeDumpOutput(xmlOutputBuffer* buf, + xmlDoc* doc, xmlNode* cur, int level, +- int format, const_char* encoding) nogil ++ int format, const_char* encoding) + cdef void xmlBufAttrSerializeTxtContent(xmlOutputBuffer *buf, xmlDoc *doc, +- xmlAttr *attr, const_xmlChar *string) nogil +- cdef void xmlNodeSetName(xmlNode* cur, const_xmlChar* name) nogil +- cdef void xmlNodeSetContent(xmlNode* cur, const_xmlChar* content) nogil +- cdef xmlDtd* xmlCopyDtd(xmlDtd* dtd) nogil +- cdef xmlDoc* xmlCopyDoc(xmlDoc* doc, int recursive) nogil +- cdef xmlNode* xmlCopyNode(xmlNode* node, int extended) nogil +- cdef xmlNode* xmlDocCopyNode(xmlNode* node, xmlDoc* doc, int extended) nogil +- cdef int xmlReconciliateNs(xmlDoc* doc, xmlNode* tree) nogil +- cdef xmlNs* xmlNewReconciliedNs(xmlDoc* doc, xmlNode* tree, xmlNs* ns) nogil +- cdef xmlBuffer* xmlBufferCreate() nogil +- cdef void xmlBufferWriteChar(xmlBuffer* buf, char* string) nogil +- cdef void xmlBufferFree(xmlBuffer* buf) nogil +- cdef const_xmlChar* xmlBufferContent(xmlBuffer* buf) nogil +- cdef int xmlBufferLength(xmlBuffer* buf) nogil +- cdef const_xmlChar* xmlBufContent(xmlBuf* buf) nogil # new in libxml2 2.9 +- cdef size_t xmlBufUse(xmlBuf* buf) nogil # new in libxml2 2.9 +- cdef int xmlKeepBlanksDefault(int val) nogil +- cdef xmlChar* xmlNodeGetBase(xmlDoc* doc, xmlNode* node) nogil ++ xmlAttr *attr, const_xmlChar *string) ++ cdef void xmlNodeSetName(xmlNode* cur, const_xmlChar* name) ++ cdef void xmlNodeSetContent(xmlNode* cur, const_xmlChar* content) ++ cdef xmlDtd* xmlCopyDtd(xmlDtd* dtd) ++ cdef xmlDoc* xmlCopyDoc(xmlDoc* doc, int recursive) ++ cdef xmlNode* xmlCopyNode(xmlNode* node, int extended) ++ cdef xmlNode* xmlDocCopyNode(xmlNode* node, xmlDoc* doc, int extended) ++ cdef int xmlReconciliateNs(xmlDoc* doc, xmlNode* tree) ++ cdef xmlNs* xmlNewReconciliedNs(xmlDoc* doc, xmlNode* tree, xmlNs* ns) ++ cdef xmlBuffer* xmlBufferCreate() ++ cdef void xmlBufferWriteChar(xmlBuffer* buf, char* string) ++ cdef void xmlBufferFree(xmlBuffer* buf) ++ cdef const_xmlChar* xmlBufferContent(xmlBuffer* buf) ++ cdef int xmlBufferLength(xmlBuffer* buf) ++ cdef const_xmlChar* xmlBufContent(xmlBuf* buf) # new in libxml2 2.9 ++ cdef size_t xmlBufUse(xmlBuf* buf) # new in libxml2 2.9 ++ cdef int xmlKeepBlanksDefault(int val) ++ cdef xmlChar* xmlNodeGetBase(xmlDoc* doc, xmlNode* node) + cdef xmlDtd* xmlCreateIntSubset(xmlDoc* doc, const_xmlChar* name, +- const_xmlChar* ExternalID, const_xmlChar* SystemID) nogil +- cdef void xmlNodeSetBase(xmlNode* node, const_xmlChar* uri) nogil +- cdef int xmlValidateNCName(const_xmlChar* value, int space) nogil ++ const_xmlChar* ExternalID, const_xmlChar* SystemID) ++ cdef void xmlNodeSetBase(xmlNode* node, const_xmlChar* uri) ++ cdef int xmlValidateNCName(const_xmlChar* value, int space) + +-cdef extern from "libxml/uri.h": +- cdef const_xmlChar* xmlBuildURI(const_xmlChar* href, const_xmlChar* base) nogil ++cdef extern from "libxml/uri.h" nogil: ++ cdef const_xmlChar* xmlBuildURI(const_xmlChar* href, const_xmlChar* base) + +-cdef extern from "libxml/HTMLtree.h": ++cdef extern from "libxml/HTMLtree.h" nogil: + cdef void htmlNodeDumpFormatOutput(xmlOutputBuffer* buf, + xmlDoc* doc, xmlNode* cur, +- char* encoding, int format) nogil +- cdef xmlDoc* htmlNewDoc(const_xmlChar* uri, const_xmlChar* externalID) nogil ++ char* encoding, int format) ++ cdef xmlDoc* htmlNewDoc(const_xmlChar* uri, const_xmlChar* externalID) + +-cdef extern from "libxml/valid.h": +- cdef xmlAttr* xmlGetID(xmlDoc* doc, const_xmlChar* ID) nogil ++cdef extern from "libxml/valid.h" nogil: ++ cdef xmlAttr* xmlGetID(xmlDoc* doc, const_xmlChar* ID) + cdef void xmlDumpNotationTable(xmlBuffer* buffer, +- xmlNotationTable* table) nogil +- cdef int xmlValidateNameValue(const_xmlChar* value) nogil ++ xmlNotationTable* table) ++ cdef int xmlValidateNameValue(const_xmlChar* value) + + cdef extern from "libxml/xmlIO.h": + cdef int xmlOutputBufferWrite(xmlOutputBuffer* out, +@@ -411,8 +411,8 @@ cdef extern from "libxml/xmlIO.h": + cdef int xmlOutputBufferClose(xmlOutputBuffer* out) nogil + + ctypedef int (*xmlInputReadCallback)(void* context, +- char* buffer, int len) +- ctypedef int (*xmlInputCloseCallback)(void* context) ++ char* buffer, int len) nogil ++ ctypedef int (*xmlInputCloseCallback)(void* context) nogil + + ctypedef int (*xmlOutputWriteCallback)(void* context, + char* buffer, int len) +@@ -430,7 +430,7 @@ cdef extern from "libxml/xmlIO.h": + cdef xmlOutputBuffer* xmlOutputBufferCreateFilename( + char* URI, xmlCharEncodingHandler* encoder, int compression) nogil + +-cdef extern from "libxml/xmlsave.h": ++cdef extern from "libxml/xmlsave.h" nogil: + ctypedef struct xmlSaveCtxt + + ctypedef enum xmlSaveOption: +@@ -443,20 +443,20 @@ cdef extern from "libxml/xmlsave.h": + XML_SAVE_AS_HTML = 64 # force HTML serialization on XML doc (2.7.2) + + cdef xmlSaveCtxt* xmlSaveToFilename(char* filename, char* encoding, +- int options) nogil ++ int options) + cdef xmlSaveCtxt* xmlSaveToBuffer(xmlBuffer* buffer, char* encoding, +- int options) nogil # libxml2 2.6.23 +- cdef long xmlSaveDoc(xmlSaveCtxt* ctxt, xmlDoc* doc) nogil +- cdef long xmlSaveTree(xmlSaveCtxt* ctxt, xmlNode* node) nogil +- cdef int xmlSaveClose(xmlSaveCtxt* ctxt) nogil +- cdef int xmlSaveFlush(xmlSaveCtxt* ctxt) nogil +- cdef int xmlSaveSetAttrEscape(xmlSaveCtxt* ctxt, void* escape_func) nogil +- cdef int xmlSaveSetEscape(xmlSaveCtxt* ctxt, void* escape_func) nogil +- +-cdef extern from "libxml/globals.h": +- cdef int xmlThrDefKeepBlanksDefaultValue(int onoff) nogil +- cdef int xmlThrDefLineNumbersDefaultValue(int onoff) nogil +- cdef int xmlThrDefIndentTreeOutput(int onoff) nogil ++ int options) # libxml2 2.6.23 ++ cdef long xmlSaveDoc(xmlSaveCtxt* ctxt, xmlDoc* doc) ++ cdef long xmlSaveTree(xmlSaveCtxt* ctxt, xmlNode* node) ++ cdef int xmlSaveClose(xmlSaveCtxt* ctxt) ++ cdef int xmlSaveFlush(xmlSaveCtxt* ctxt) ++ cdef int xmlSaveSetAttrEscape(xmlSaveCtxt* ctxt, void* escape_func) ++ cdef int xmlSaveSetEscape(xmlSaveCtxt* ctxt, void* escape_func) ++ ++cdef extern from "libxml/globals.h" nogil: ++ cdef int xmlThrDefKeepBlanksDefaultValue(int onoff) ++ cdef int xmlThrDefLineNumbersDefaultValue(int onoff) ++ cdef int xmlThrDefIndentTreeOutput(int onoff) + + cdef extern from "libxml/xmlmemory.h" nogil: + cdef void* xmlMalloc(size_t size) +@@ -466,15 +466,15 @@ cdef extern from "libxml/xmlmemory.h" nogil: + cdef void xmlMemDisplayLast(stdio.FILE* file, long num_bytes) + cdef void xmlMemShow(stdio.FILE* file, int count) + +-cdef extern from "etree_defs.h": +- cdef bint _isElement(xmlNode* node) nogil +- cdef bint _isElementOrXInclude(xmlNode* node) nogil +- cdef const_xmlChar* _getNs(xmlNode* node) nogil ++cdef extern from "etree_defs.h" nogil: ++ cdef bint _isElement(xmlNode* node) ++ cdef bint _isElementOrXInclude(xmlNode* node) ++ cdef const_xmlChar* _getNs(xmlNode* node) + cdef void BEGIN_FOR_EACH_ELEMENT_FROM(xmlNode* tree_top, + xmlNode* start_node, +- bint inclusive) nogil +- cdef void END_FOR_EACH_ELEMENT_FROM(xmlNode* start_node) nogil ++ bint inclusive) ++ cdef void END_FOR_EACH_ELEMENT_FROM(xmlNode* start_node) + cdef void BEGIN_FOR_EACH_FROM(xmlNode* tree_top, + xmlNode* start_node, +- bint inclusive) nogil +- cdef void END_FOR_EACH_FROM(xmlNode* start_node) nogil ++ bint inclusive) ++ cdef void END_FOR_EACH_FROM(xmlNode* start_node) +diff --git a/src/lxml/includes/uri.pxd b/src/lxml/includes/uri.pxd +index 2b6bb79f3..f886a54b9 100644 +--- a/src/lxml/includes/uri.pxd ++++ b/src/lxml/includes/uri.pxd +@@ -1,4 +1,4 @@ +-cdef extern from "libxml/uri.h": ++cdef extern from "libxml/uri.h" nogil: + ctypedef struct xmlURI + + cdef xmlURI* xmlParseURI(char* str) +diff --git a/src/lxml/includes/xinclude.pxd b/src/lxml/includes/xinclude.pxd +index 4232d3e43..68267175a 100644 +--- a/src/lxml/includes/xinclude.pxd ++++ b/src/lxml/includes/xinclude.pxd +@@ -1,22 +1,22 @@ + from lxml.includes.tree cimport xmlDoc, xmlNode + +-cdef extern from "libxml/xinclude.h": ++cdef extern from "libxml/xinclude.h" nogil: + + ctypedef struct xmlXIncludeCtxt + +- cdef int xmlXIncludeProcess(xmlDoc* doc) nogil +- cdef int xmlXIncludeProcessFlags(xmlDoc* doc, int parser_opts) nogil +- cdef int xmlXIncludeProcessTree(xmlNode* doc) nogil +- cdef int xmlXIncludeProcessTreeFlags(xmlNode* doc, int parser_opts) nogil ++ cdef int xmlXIncludeProcess(xmlDoc* doc) ++ cdef int xmlXIncludeProcessFlags(xmlDoc* doc, int parser_opts) ++ cdef int xmlXIncludeProcessTree(xmlNode* doc) ++ cdef int xmlXIncludeProcessTreeFlags(xmlNode* doc, int parser_opts) + + # libxml2 >= 2.7.4 + cdef int xmlXIncludeProcessTreeFlagsData( +- xmlNode* doc, int parser_opts, void* data) nogil ++ xmlNode* doc, int parser_opts, void* data) + +- cdef xmlXIncludeCtxt* xmlXIncludeNewContext(xmlDoc* doc) nogil +- cdef int xmlXIncludeProcessNode(xmlXIncludeCtxt* ctxt, xmlNode* node) nogil +- cdef int xmlXIncludeSetFlags(xmlXIncludeCtxt* ctxt, int flags) nogil ++ cdef xmlXIncludeCtxt* xmlXIncludeNewContext(xmlDoc* doc) ++ cdef int xmlXIncludeProcessNode(xmlXIncludeCtxt* ctxt, xmlNode* node) ++ cdef int xmlXIncludeSetFlags(xmlXIncludeCtxt* ctxt, int flags) + + # libxml2 >= 2.6.27 + cdef int xmlXIncludeProcessFlagsData( +- xmlDoc* doc, int flags, void* data) nogil ++ xmlDoc* doc, int flags, void* data) +diff --git a/src/lxml/includes/xmlerror.pxd b/src/lxml/includes/xmlerror.pxd +index 13c8f3782..c5ac6a0aa 100644 +--- a/src/lxml/includes/xmlerror.pxd ++++ b/src/lxml/includes/xmlerror.pxd +@@ -823,7 +823,7 @@ cdef extern from "libxml/xmlerror.h": + XML_RELAXNG_ERR_TEXTWRONG = 39 + # --- END: GENERATED CONSTANTS --- + +-cdef extern from "libxml/xmlerror.h": ++cdef extern from "libxml/xmlerror.h" nogil: + ctypedef struct xmlError: + int domain + int code +@@ -838,15 +838,15 @@ cdef extern from "libxml/xmlerror.h": + int int2 + void* node + +- ctypedef void (*xmlGenericErrorFunc)(void* ctxt, char* msg, ...) nogil ++ ctypedef void (*xmlGenericErrorFunc)(void* ctxt, char* msg, ...) + ctypedef void (*xmlStructuredErrorFunc)(void* userData, +- xmlError* error) nogil ++ xmlError* error) + + cdef void xmlSetGenericErrorFunc( +- void* ctxt, xmlGenericErrorFunc func) nogil ++ void* ctxt, xmlGenericErrorFunc func) + cdef void xmlSetStructuredErrorFunc( +- void* ctxt, xmlStructuredErrorFunc func) nogil ++ void* ctxt, xmlStructuredErrorFunc func) + +-cdef extern from "libxml/globals.h": ++cdef extern from "libxml/globals.h" nogil: + cdef xmlStructuredErrorFunc xmlStructuredError + cdef void* xmlStructuredErrorContext +diff --git a/src/lxml/includes/xmlparser.pxd b/src/lxml/includes/xmlparser.pxd +index 45acfc846..9f3056248 100644 +--- a/src/lxml/includes/xmlparser.pxd ++++ b/src/lxml/includes/xmlparser.pxd +@@ -6,7 +6,7 @@ from lxml.includes.tree cimport xmlInputReadCallback, xmlInputCloseCallback + from lxml.includes.xmlerror cimport xmlError, xmlStructuredErrorFunc + + +-cdef extern from "libxml/parser.h": ++cdef extern from "libxml/parser.h" nogil: + ctypedef void (*startElementNsSAX2Func)(void* ctx, + const_xmlChar* localname, + const_xmlChar* prefix, +@@ -49,7 +49,7 @@ cdef extern from "libxml/parser.h": + + cdef int XML_SAX2_MAGIC + +-cdef extern from "libxml/tree.h": ++cdef extern from "libxml/tree.h" nogil: + ctypedef struct xmlParserInput: + int line + int length +@@ -93,12 +93,12 @@ cdef extern from "libxml/xmlIO.h" nogil: + cdef xmlParserInputBuffer* xmlAllocParserInputBuffer(int enc) + + +-cdef extern from "libxml/parser.h": ++cdef extern from "libxml/parser.h" nogil: + +- cdef xmlDict* xmlDictCreate() nogil +- cdef xmlDict* xmlDictCreateSub(xmlDict* subdict) nogil +- cdef void xmlDictFree(xmlDict* sub) nogil +- cdef int xmlDictReference(xmlDict* dict) nogil ++ cdef xmlDict* xmlDictCreate() ++ cdef xmlDict* xmlDictCreateSub(xmlDict* subdict) ++ cdef void xmlDictFree(xmlDict* sub) ++ cdef int xmlDictReference(xmlDict* dict) + + cdef int XML_COMPLETE_ATTRS # SAX option for adding DTD default attributes + cdef int XML_SKIP_IDS # SAX option for not building an XML ID dict +@@ -181,36 +181,36 @@ cdef extern from "libxml/parser.h": + # libxml2 2.9.0+ only: + XML_PARSE_BIG_LINES = 4194304 # Store big lines numbers in text PSVI field + +- cdef void xmlInitParser() nogil +- cdef void xmlCleanupParser() nogil ++ cdef void xmlInitParser() ++ cdef void xmlCleanupParser() + +- cdef int xmlLineNumbersDefault(int onoff) nogil +- cdef xmlParserCtxt* xmlNewParserCtxt() nogil ++ cdef int xmlLineNumbersDefault(int onoff) ++ cdef xmlParserCtxt* xmlNewParserCtxt() + cdef xmlParserInput* xmlNewIOInputStream(xmlParserCtxt* ctxt, + xmlParserInputBuffer* input, +- int enc) nogil +- cdef int xmlCtxtUseOptions(xmlParserCtxt* ctxt, int options) nogil +- cdef void xmlFreeParserCtxt(xmlParserCtxt* ctxt) nogil +- cdef void xmlCtxtReset(xmlParserCtxt* ctxt) nogil +- cdef void xmlClearParserCtxt(xmlParserCtxt* ctxt) nogil ++ int enc) ++ cdef int xmlCtxtUseOptions(xmlParserCtxt* ctxt, int options) ++ cdef void xmlFreeParserCtxt(xmlParserCtxt* ctxt) ++ cdef void xmlCtxtReset(xmlParserCtxt* ctxt) ++ cdef void xmlClearParserCtxt(xmlParserCtxt* ctxt) + cdef int xmlParseChunk(xmlParserCtxt* ctxt, +- char* chunk, int size, int terminate) nogil ++ char* chunk, int size, int terminate) + cdef xmlDoc* xmlCtxtReadDoc(xmlParserCtxt* ctxt, + char* cur, char* URL, char* encoding, +- int options) nogil ++ int options) + cdef xmlDoc* xmlCtxtReadFile(xmlParserCtxt* ctxt, + char* filename, char* encoding, +- int options) nogil ++ int options) + cdef xmlDoc* xmlCtxtReadIO(xmlParserCtxt* ctxt, + xmlInputReadCallback ioread, + xmlInputCloseCallback ioclose, + void* ioctx, + char* URL, char* encoding, +- int options) nogil ++ int options) + cdef xmlDoc* xmlCtxtReadMemory(xmlParserCtxt* ctxt, + char* buffer, int size, + char* filename, const_char* encoding, +- int options) nogil ++ int options) + + # iterparse: + +@@ -218,33 +218,34 @@ cdef extern from "libxml/parser.h": + void* user_data, + char* chunk, + int size, +- char* filename) nogil ++ char* filename) + + cdef int xmlCtxtResetPush(xmlParserCtxt* ctxt, + char* chunk, + int size, + char* filename, +- char* encoding) nogil ++ char* encoding) + + # entity loaders: + + ctypedef xmlParserInput* (*xmlExternalEntityLoader)( +- const_char * URL, const_char * ID, xmlParserCtxt* context) nogil +- cdef xmlExternalEntityLoader xmlGetExternalEntityLoader() nogil +- cdef void xmlSetExternalEntityLoader(xmlExternalEntityLoader f) nogil ++ const_char * URL, const_char * ID, xmlParserCtxt* context) ++ cdef xmlExternalEntityLoader xmlGetExternalEntityLoader() ++ cdef void xmlSetExternalEntityLoader(xmlExternalEntityLoader f) + + # DTDs: + +- cdef xmlDtd* xmlParseDTD(const_xmlChar* ExternalID, const_xmlChar* SystemID) nogil ++ cdef xmlDtd* xmlParseDTD(const_xmlChar* ExternalID, const_xmlChar* SystemID) + cdef xmlDtd* xmlIOParseDTD(xmlSAXHandler* sax, + xmlParserInputBuffer* input, +- int enc) nogil ++ int enc) + +-cdef extern from "libxml/parserInternals.h": ++ ++cdef extern from "libxml/parserInternals.h" nogil: + cdef xmlParserInput* xmlNewInputStream(xmlParserCtxt* ctxt) + cdef xmlParserInput* xmlNewStringInputStream(xmlParserCtxt* ctxt, +- char* buffer) nogil ++ char* buffer) + cdef xmlParserInput* xmlNewInputFromFile(xmlParserCtxt* ctxt, +- char* filename) nogil +- cdef void xmlFreeInputStream(xmlParserInput* input) nogil +- cdef int xmlSwitchEncoding(xmlParserCtxt* ctxt, int enc) nogil ++ char* filename) ++ cdef void xmlFreeInputStream(xmlParserInput* input) ++ cdef int xmlSwitchEncoding(xmlParserCtxt* ctxt, int enc) +diff --git a/src/lxml/includes/xmlschema.pxd b/src/lxml/includes/xmlschema.pxd +index 8e93cc570..067411113 100644 +--- a/src/lxml/includes/xmlschema.pxd ++++ b/src/lxml/includes/xmlschema.pxd +@@ -2,7 +2,7 @@ from lxml.includes.tree cimport xmlDoc + from lxml.includes.xmlparser cimport xmlSAXHandler + from lxml.includes.xmlerror cimport xmlStructuredErrorFunc + +-cdef extern from "libxml/xmlschemas.h": ++cdef extern from "libxml/xmlschemas.h" nogil: + ctypedef struct xmlSchema + ctypedef struct xmlSchemaParserCtxt + +diff --git a/src/lxml/includes/xpath.pxd b/src/lxml/includes/xpath.pxd +index d01735b68..22069eb7c 100644 +--- a/src/lxml/includes/xpath.pxd ++++ b/src/lxml/includes/xpath.pxd +@@ -4,7 +4,8 @@ from lxml.includes cimport xmlerror + from libc.string cimport const_char + from lxml.includes.tree cimport xmlChar, const_xmlChar + +-cdef extern from "libxml/xpath.h": ++ ++cdef extern from "libxml/xpath.h" nogil: + ctypedef enum xmlXPathObjectType: + XPATH_UNDEFINED = 0 + XPATH_NODESET = 1 +@@ -73,63 +74,63 @@ cdef extern from "libxml/xpath.h": + + ctypedef struct xmlXPathCompExpr + +- ctypedef void (*xmlXPathFunction)(xmlXPathParserContext* ctxt, int nargs) nogil ++ ctypedef void (*xmlXPathFunction)(xmlXPathParserContext* ctxt, int nargs) + ctypedef xmlXPathFunction (*xmlXPathFuncLookupFunc)(void* ctxt, + const_xmlChar* name, +- const_xmlChar* ns_uri) nogil ++ const_xmlChar* ns_uri) + +- cdef xmlXPathContext* xmlXPathNewContext(tree.xmlDoc* doc) nogil ++ cdef xmlXPathContext* xmlXPathNewContext(tree.xmlDoc* doc) + cdef xmlXPathObject* xmlXPathEvalExpression(const_xmlChar* str, +- xmlXPathContext* ctxt) nogil ++ xmlXPathContext* ctxt) + cdef xmlXPathObject* xmlXPathCompiledEval(xmlXPathCompExpr* comp, +- xmlXPathContext* ctxt) nogil +- cdef xmlXPathCompExpr* xmlXPathCompile(const_xmlChar* str) nogil ++ xmlXPathContext* ctxt) ++ cdef xmlXPathCompExpr* xmlXPathCompile(const_xmlChar* str) + cdef xmlXPathCompExpr* xmlXPathCtxtCompile(xmlXPathContext* ctxt, +- const_xmlChar* str) nogil +- cdef void xmlXPathFreeContext(xmlXPathContext* ctxt) nogil +- cdef void xmlXPathFreeCompExpr(xmlXPathCompExpr* comp) nogil +- cdef void xmlXPathFreeObject(xmlXPathObject* obj) nogil ++ const_xmlChar* str) ++ cdef void xmlXPathFreeContext(xmlXPathContext* ctxt) ++ cdef void xmlXPathFreeCompExpr(xmlXPathCompExpr* comp) ++ cdef void xmlXPathFreeObject(xmlXPathObject* obj) + cdef int xmlXPathRegisterNs(xmlXPathContext* ctxt, +- const_xmlChar* prefix, const_xmlChar* ns_uri) nogil ++ const_xmlChar* prefix, const_xmlChar* ns_uri) + +- cdef xmlNodeSet* xmlXPathNodeSetCreate(tree.xmlNode* val) nogil +- cdef void xmlXPathFreeNodeSet(xmlNodeSet* val) nogil ++ cdef xmlNodeSet* xmlXPathNodeSetCreate(tree.xmlNode* val) ++ cdef void xmlXPathFreeNodeSet(xmlNodeSet* val) + + +-cdef extern from "libxml/xpathInternals.h": ++cdef extern from "libxml/xpathInternals.h" nogil: + cdef int xmlXPathRegisterFunc(xmlXPathContext* ctxt, + const_xmlChar* name, +- xmlXPathFunction f) nogil ++ xmlXPathFunction f) + cdef int xmlXPathRegisterFuncNS(xmlXPathContext* ctxt, + const_xmlChar* name, + const_xmlChar* ns_uri, +- xmlXPathFunction f) nogil ++ xmlXPathFunction f) + cdef void xmlXPathRegisterFuncLookup(xmlXPathContext *ctxt, + xmlXPathFuncLookupFunc f, +- void *funcCtxt) nogil ++ void *funcCtxt) + cdef int xmlXPathRegisterVariable(xmlXPathContext *ctxt, + const_xmlChar* name, +- xmlXPathObject* value) nogil ++ xmlXPathObject* value) + cdef int xmlXPathRegisterVariableNS(xmlXPathContext *ctxt, + const_xmlChar* name, + const_xmlChar* ns_uri, +- xmlXPathObject* value) nogil +- cdef void xmlXPathRegisteredVariablesCleanup(xmlXPathContext *ctxt) nogil +- cdef void xmlXPathRegisteredNsCleanup(xmlXPathContext *ctxt) nogil +- cdef xmlXPathObject* valuePop (xmlXPathParserContext *ctxt) nogil +- cdef int valuePush(xmlXPathParserContext* ctxt, xmlXPathObject *value) nogil ++ xmlXPathObject* value) ++ cdef void xmlXPathRegisteredVariablesCleanup(xmlXPathContext *ctxt) ++ cdef void xmlXPathRegisteredNsCleanup(xmlXPathContext *ctxt) ++ cdef xmlXPathObject* valuePop (xmlXPathParserContext *ctxt) ++ cdef int valuePush(xmlXPathParserContext* ctxt, xmlXPathObject *value) + +- cdef xmlXPathObject* xmlXPathNewCString(const_char *val) nogil +- cdef xmlXPathObject* xmlXPathWrapCString(const_char * val) nogil +- cdef xmlXPathObject* xmlXPathNewString(const_xmlChar *val) nogil +- cdef xmlXPathObject* xmlXPathWrapString(const_xmlChar * val) nogil +- cdef xmlXPathObject* xmlXPathNewFloat(double val) nogil +- cdef xmlXPathObject* xmlXPathNewBoolean(int val) nogil +- cdef xmlXPathObject* xmlXPathNewNodeSet(tree.xmlNode* val) nogil +- cdef xmlXPathObject* xmlXPathNewValueTree(tree.xmlNode* val) nogil ++ cdef xmlXPathObject* xmlXPathNewCString(const_char *val) ++ cdef xmlXPathObject* xmlXPathWrapCString(const_char * val) ++ cdef xmlXPathObject* xmlXPathNewString(const_xmlChar *val) ++ cdef xmlXPathObject* xmlXPathWrapString(const_xmlChar * val) ++ cdef xmlXPathObject* xmlXPathNewFloat(double val) ++ cdef xmlXPathObject* xmlXPathNewBoolean(int val) ++ cdef xmlXPathObject* xmlXPathNewNodeSet(tree.xmlNode* val) ++ cdef xmlXPathObject* xmlXPathNewValueTree(tree.xmlNode* val) + cdef void xmlXPathNodeSetAdd(xmlNodeSet* cur, +- tree.xmlNode* val) nogil ++ tree.xmlNode* val) + cdef void xmlXPathNodeSetAddUnique(xmlNodeSet* cur, +- tree.xmlNode* val) nogil +- cdef xmlXPathObject* xmlXPathWrapNodeSet(xmlNodeSet* val) nogil +- cdef void xmlXPathErr(xmlXPathParserContext* ctxt, int error) nogil ++ tree.xmlNode* val) ++ cdef xmlXPathObject* xmlXPathWrapNodeSet(xmlNodeSet* val) ++ cdef void xmlXPathErr(xmlXPathParserContext* ctxt, int error) +diff --git a/src/lxml/includes/xslt.pxd b/src/lxml/includes/xslt.pxd +index 101fb7e78..05d2d4b9b 100644 +--- a/src/lxml/includes/xslt.pxd ++++ b/src/lxml/includes/xslt.pxd +@@ -11,7 +11,7 @@ cdef extern from "libxslt/xslt.h": + cdef extern from "libxslt/xsltconfig.h": + cdef int LIBXSLT_VERSION + +-cdef extern from "libxslt/xsltInternals.h": ++cdef extern from "libxslt/xsltInternals.h" nogil: + ctypedef enum xsltTransformState: + XSLT_STATE_OK # 0 + XSLT_STATE_ERROR # 1 +@@ -42,35 +42,35 @@ cdef extern from "libxslt/xsltInternals.h": + + ctypedef struct xsltTemplate + +- cdef xsltStylesheet* xsltParseStylesheetDoc(xmlDoc* doc) nogil +- cdef void xsltFreeStylesheet(xsltStylesheet* sheet) nogil ++ cdef xsltStylesheet* xsltParseStylesheetDoc(xmlDoc* doc) ++ cdef void xsltFreeStylesheet(xsltStylesheet* sheet) + +-cdef extern from "libxslt/imports.h": ++cdef extern from "libxslt/imports.h" nogil: + # actually defined in "etree_defs.h" + cdef void LXML_GET_XSLT_ENCODING(const_xmlChar* result_var, xsltStylesheet* style) + +-cdef extern from "libxslt/extensions.h": ++cdef extern from "libxslt/extensions.h" nogil: + ctypedef void (*xsltTransformFunction)(xsltTransformContext* ctxt, + xmlNode* context_node, + xmlNode* inst, +- void* precomp_unused) nogil ++ void* precomp_unused) + + cdef int xsltRegisterExtFunction(xsltTransformContext* ctxt, + const_xmlChar* name, + const_xmlChar* URI, +- xmlXPathFunction function) nogil ++ xmlXPathFunction function) + cdef int xsltRegisterExtModuleFunction(const_xmlChar* name, const_xmlChar* URI, +- xmlXPathFunction function) nogil ++ xmlXPathFunction function) + cdef int xsltUnregisterExtModuleFunction(const_xmlChar* name, const_xmlChar* URI) + cdef xmlXPathFunction xsltExtModuleFunctionLookup( +- const_xmlChar* name, const_xmlChar* URI) nogil ++ const_xmlChar* name, const_xmlChar* URI) + cdef int xsltRegisterExtPrefix(xsltStylesheet* style, +- const_xmlChar* prefix, const_xmlChar* URI) nogil ++ const_xmlChar* prefix, const_xmlChar* URI) + cdef int xsltRegisterExtElement(xsltTransformContext* ctxt, + const_xmlChar* name, const_xmlChar* URI, +- xsltTransformFunction function) nogil ++ xsltTransformFunction function) + +-cdef extern from "libxslt/documents.h": ++cdef extern from "libxslt/documents.h" nogil: + ctypedef enum xsltLoadType: + XSLT_LOAD_START + XSLT_LOAD_STYLESHEET +@@ -79,48 +79,48 @@ cdef extern from "libxslt/documents.h": + ctypedef xmlDoc* (*xsltDocLoaderFunc)(const_xmlChar* URI, xmlDict* dict, + int options, + void* ctxt, +- xsltLoadType type) nogil ++ xsltLoadType type) + cdef xsltDocLoaderFunc xsltDocDefaultLoader +- cdef void xsltSetLoaderFunc(xsltDocLoaderFunc f) nogil ++ cdef void xsltSetLoaderFunc(xsltDocLoaderFunc f) + +-cdef extern from "libxslt/transform.h": ++cdef extern from "libxslt/transform.h" nogil: + cdef xmlDoc* xsltApplyStylesheet(xsltStylesheet* style, xmlDoc* doc, +- const_char** params) nogil ++ const_char** params) + cdef xmlDoc* xsltApplyStylesheetUser(xsltStylesheet* style, xmlDoc* doc, + const_char** params, const_char* output, + void* profile, +- xsltTransformContext* context) nogil ++ xsltTransformContext* context) + cdef void xsltProcessOneNode(xsltTransformContext* ctxt, + xmlNode* contextNode, +- xsltStackElem* params) nogil ++ xsltStackElem* params) + cdef xsltTransformContext* xsltNewTransformContext(xsltStylesheet* style, +- xmlDoc* doc) nogil +- cdef void xsltFreeTransformContext(xsltTransformContext* context) nogil ++ xmlDoc* doc) ++ cdef void xsltFreeTransformContext(xsltTransformContext* context) + cdef void xsltApplyOneTemplate(xsltTransformContext* ctxt, + xmlNode* contextNode, xmlNode* list, + xsltTemplate* templ, +- xsltStackElem* params) nogil ++ xsltStackElem* params) + + +-cdef extern from "libxslt/xsltutils.h": ++cdef extern from "libxslt/xsltutils.h" nogil: + cdef int xsltSaveResultToString(xmlChar** doc_txt_ptr, + int* doc_txt_len, + xmlDoc* result, +- xsltStylesheet* style) nogil ++ xsltStylesheet* style) + cdef int xsltSaveResultToFilename(const_char *URL, + xmlDoc* result, + xsltStylesheet* style, +- int compression) nogil ++ int compression) + cdef int xsltSaveResultTo(xmlOutputBuffer* buf, + xmlDoc* result, +- xsltStylesheet* style) nogil ++ xsltStylesheet* style) + cdef xmlGenericErrorFunc xsltGenericError + cdef void *xsltGenericErrorContext + cdef void xsltSetGenericErrorFunc( +- void* ctxt, void (*handler)(void* ctxt, char* msg, ...)) nogil ++ void* ctxt, void (*handler)(void* ctxt, char* msg, ...) nogil) + cdef void xsltSetTransformErrorFunc( + xsltTransformContext*, void* ctxt, +- void (*handler)(void* ctxt, char* msg, ...) nogil) nogil ++ void (*handler)(void* ctxt, char* msg, ...) nogil) + cdef void xsltTransformError(xsltTransformContext* ctxt, + xsltStylesheet* style, + xmlNode* node, char* msg, ...) +@@ -128,7 +128,7 @@ cdef extern from "libxslt/xsltutils.h": + xsltTransformContext* ctxt, int options) + + +-cdef extern from "libxslt/security.h": ++cdef extern from "libxslt/security.h" nogil: + ctypedef struct xsltSecurityPrefs + ctypedef enum xsltSecurityOption: + XSLT_SECPREF_READ_FILE = 1 +@@ -139,44 +139,44 @@ cdef extern from "libxslt/security.h": + + ctypedef int (*xsltSecurityCheck)(xsltSecurityPrefs* sec, + xsltTransformContext* ctxt, +- char* value) nogil ++ char* value) + +- cdef xsltSecurityPrefs* xsltNewSecurityPrefs() nogil +- cdef void xsltFreeSecurityPrefs(xsltSecurityPrefs* sec) nogil ++ cdef xsltSecurityPrefs* xsltNewSecurityPrefs() ++ cdef void xsltFreeSecurityPrefs(xsltSecurityPrefs* sec) + cdef int xsltSecurityForbid(xsltSecurityPrefs* sec, + xsltTransformContext* ctxt, +- char* value) nogil ++ char* value) + cdef int xsltSecurityAllow(xsltSecurityPrefs* sec, + xsltTransformContext* ctxt, +- char* value) nogil ++ char* value) + cdef int xsltSetSecurityPrefs(xsltSecurityPrefs* sec, + xsltSecurityOption option, +- xsltSecurityCheck func) nogil ++ xsltSecurityCheck func) + cdef xsltSecurityCheck xsltGetSecurityPrefs( + xsltSecurityPrefs* sec, +- xsltSecurityOption option) nogil ++ xsltSecurityOption option) + cdef int xsltSetCtxtSecurityPrefs(xsltSecurityPrefs* sec, +- xsltTransformContext* ctxt) nogil +- cdef xmlDoc* xsltGetProfileInformation(xsltTransformContext* ctxt) nogil ++ xsltTransformContext* ctxt) ++ cdef xmlDoc* xsltGetProfileInformation(xsltTransformContext* ctxt) + +-cdef extern from "libxslt/variables.h": ++cdef extern from "libxslt/variables.h" nogil: + cdef int xsltQuoteUserParams(xsltTransformContext* ctxt, + const_char** params) + cdef int xsltQuoteOneUserParam(xsltTransformContext* ctxt, + const_xmlChar* name, + const_xmlChar* value) + +-cdef extern from "libxslt/extra.h": ++cdef extern from "libxslt/extra.h" nogil: + const_xmlChar* XSLT_LIBXSLT_NAMESPACE + const_xmlChar* XSLT_XALAN_NAMESPACE + const_xmlChar* XSLT_SAXON_NAMESPACE + const_xmlChar* XSLT_XT_NAMESPACE + + cdef xmlXPathFunction xsltFunctionNodeSet +- cdef void xsltRegisterAllExtras() nogil ++ cdef void xsltRegisterAllExtras() + +-cdef extern from "libexslt/exslt.h": +- cdef void exsltRegisterAll() nogil ++cdef extern from "libexslt/exslt.h" nogil: ++ cdef void exsltRegisterAll() + + # libexslt 1.1.25+ + const_xmlChar* EXSLT_DATE_NAMESPACE +@@ -188,4 +188,3 @@ cdef extern from "libexslt/exslt.h": + cdef int exsltSetsXpathCtxtRegister(xmlXPathContext* ctxt, const_xmlChar* prefix) + cdef int exsltMathXpathCtxtRegister(xmlXPathContext* ctxt, const_xmlChar* prefix) + cdef int exsltStrXpathCtxtRegister(xmlXPathContext* ctxt, const_xmlChar* prefix) +- diff --git a/python-lxml.spec b/python-lxml.spec index a2ce417..c25bc4d 100644 --- a/python-lxml.spec +++ b/python-lxml.spec @@ -1,6 +1,6 @@ Name: python-lxml Version: 4.9.3 -Release: 1%{?dist} +Release: 2%{?dist} Summary: XML processing library combining libxml2/libxslt with the ElementTree API # The lxml project is licensed under BSD-3-Clause @@ -27,6 +27,10 @@ Patch: https://github.com/lxml/lxml/pull/380.patch # Upstream issue: https://bugs.launchpad.net/lxml/+bug/2016939 Patch: Skip-failing-test-test_html_prefix_nsmap.patch +# Cython 3 support backported from future lxml 5.0 +Patch: https://github.com/lxml/lxml/commit/dcbc0cc1cb0cedf8019184aaca805d2a649cd8de.patch +Patch: https://github.com/lxml/lxml/commit/a03a4b3c6b906d33c5ef1a15f3d5ca5fff600c76.patch + BuildRequires: gcc BuildRequires: libxml2-devel BuildRequires: libxslt-devel @@ -68,8 +72,6 @@ Python 3 version. %autosetup -n lxml-%{version} -p1 # Don't run html5lib tests --without extras %{!?without_extras:rm src/lxml/html/tests/test_html5parser.py} -# lxml 4.9 is not yet ready for Cython 3 -sed -Ei 's/Cython>=([^,]+)/Cython>=\1,<3/' requirements.txt %generate_buildrequires %pyproject_buildrequires -x source%{?with_extras:,cssselect,html5,htmlsoup} @@ -98,6 +100,9 @@ cp -a build/lib.%{python3_platform}-*/* src/ %doc README.rst %changelog +* Fri Jul 28 2023 Miro Hrončok - 4.9.3-2 +- Fix build with Cython 3 + * Fri Jul 21 2023 Lumír Balhar - 4.9.3-1 - Update to 4.9.3 (rhbz#2219811) From 3b50336b27ee1305cbd58090b9f954a434be0339 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Mon, 30 Oct 2023 12:36:41 +0100 Subject: [PATCH 16/47] Remove pregenerated Cython C sources in %build In a future version of mock, %prep will only run once, which breaks the prior state of this package. Previously, this only worked because each %prep round restored the pregenerated files for the setup.py logic to see. However, when %prep only runs once, the second round of %pyproject_buildrequires fails unless Cython is already installed, which is not the default case, as the dependency has not yet been generated. See https://github.com/rpm-software-management/mock/pull/1250 --- python-lxml.spec | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/python-lxml.spec b/python-lxml.spec index c25bc4d..7b713b0 100644 --- a/python-lxml.spec +++ b/python-lxml.spec @@ -1,6 +1,6 @@ Name: python-lxml Version: 4.9.3 -Release: 2%{?dist} +Release: 3%{?dist} Summary: XML processing library combining libxml2/libxslt with the ElementTree API # The lxml project is licensed under BSD-3-Clause @@ -75,12 +75,12 @@ Python 3 version. %generate_buildrequires %pyproject_buildrequires -x source%{?with_extras:,cssselect,html5,htmlsoup} + +%build # Remove pregenerated Cython C sources # We need to do this after %%pyproject_buildrequires because setup.py errors # without Cython and without the .c files. find -type f -name '*.c' -print -delete >&2 - -%build export WITH_CYTHON=true %pyproject_wheel @@ -100,6 +100,9 @@ cp -a build/lib.%{python3_platform}-*/* src/ %doc README.rst %changelog +* Mon Oct 30 2023 Miro Hrončok - 4.9.3-3 +- Fix build with a future mock version + * Fri Jul 28 2023 Miro Hrončok - 4.9.3-2 - Fix build with Cython 3 From 9fac0d55014b6804530b7684258c7423d5999b8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Mon, 6 Nov 2023 11:43:32 +0100 Subject: [PATCH 17/47] Python 3.13 compatibility This only changes the tests. Fixes https://bugzilla.redhat.com/2247011 --- ...7968a67151f02db491a56a0037b55319931d.patch | 482 ++++++++++++++++++ ...5653e182f9203189cbde0ab2d6ebec556db8.patch | 47 ++ python-lxml.spec | 4 + 3 files changed, 533 insertions(+) create mode 100644 34187968a67151f02db491a56a0037b55319931d.patch create mode 100644 98025653e182f9203189cbde0ab2d6ebec556db8.patch diff --git a/34187968a67151f02db491a56a0037b55319931d.patch b/34187968a67151f02db491a56a0037b55319931d.patch new file mode 100644 index 0000000..9a153b6 --- /dev/null +++ b/34187968a67151f02db491a56a0037b55319931d.patch @@ -0,0 +1,482 @@ +From 34187968a67151f02db491a56a0037b55319931d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= +Date: Mon, 30 Oct 2023 20:21:55 +0100 +Subject: [PATCH] Avoid usage of unittest.makeSuite(), removed from Python 3.13 + (GH-385) + +Patch generated by: + + sed -i 's/unittest.makeSuite/unittest.defaultTestLoader.loadTestsFromTestCase/g' $(grep -rl makeSuite) +--- + src/lxml/html/tests/test_clean.py | 2 +- + src/lxml/html/tests/test_elementsoup.py | 2 +- + src/lxml/tests/test_builder.py | 2 +- + src/lxml/tests/test_classlookup.py | 4 ++-- + src/lxml/tests/test_css.py | 2 +- + src/lxml/tests/test_doctestcompare.py | 2 +- + src/lxml/tests/test_dtd.py | 2 +- + src/lxml/tests/test_elementpath.py | 4 ++-- + src/lxml/tests/test_elementtree.py | 24 +++++++++++----------- + src/lxml/tests/test_errors.py | 2 +- + src/lxml/tests/test_etree.py | 14 ++++++------- + src/lxml/tests/test_external_document.py | 2 +- + src/lxml/tests/test_htmlparser.py | 2 +- + src/lxml/tests/test_http_io.py | 2 +- + src/lxml/tests/test_incremental_xmlfile.py | 12 +++++------ + src/lxml/tests/test_io.py | 4 ++-- + src/lxml/tests/test_isoschematron.py | 2 +- + src/lxml/tests/test_nsclasses.py | 2 +- + src/lxml/tests/test_objectify.py | 2 +- + src/lxml/tests/test_pyclasslookup.py | 2 +- + src/lxml/tests/test_relaxng.py | 4 ++-- + src/lxml/tests/test_sax.py | 4 ++-- + src/lxml/tests/test_schematron.py | 2 +- + src/lxml/tests/test_threading.py | 4 ++-- + src/lxml/tests/test_unicode.py | 4 ++-- + src/lxml/tests/test_xmlschema.py | 4 ++-- + src/lxml/tests/test_xpathevaluator.py | 8 ++++---- + src/lxml/tests/test_xslt.py | 10 ++++----- + 28 files changed, 65 insertions(+), 65 deletions(-) + +diff --git a/src/lxml/html/tests/test_clean.py b/src/lxml/html/tests/test_clean.py +index ada0969bc..fe79f6d5b 100644 +--- a/src/lxml/html/tests/test_clean.py ++++ b/src/lxml/html/tests/test_clean.py +@@ -296,5 +296,5 @@ def test_suite(): + suite = unittest.TestSuite() + suite.addTests([make_doctest('test_clean.txt')]) + suite.addTests([make_doctest('test_clean_embed.txt')]) +- suite.addTests(unittest.makeSuite(CleanerTest)) ++ suite.addTests(unittest.defaultTestLoader.loadTestsFromTestCase(CleanerTest)) + return suite +diff --git a/src/lxml/html/tests/test_elementsoup.py b/src/lxml/html/tests/test_elementsoup.py +index 553586b9f..1fd9127a4 100644 +--- a/src/lxml/html/tests/test_elementsoup.py ++++ b/src/lxml/html/tests/test_elementsoup.py +@@ -118,7 +118,7 @@ def test_doctype_html5(self): + def test_suite(): + suite = unittest.TestSuite() + if BS_INSTALLED: +- suite.addTests([unittest.makeSuite(SoupParserTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(SoupParserTestCase)]) + if sys.version_info[0] < 3: + suite.addTests([make_doctest('../../../../doc/elementsoup.txt')]) + return suite +diff --git a/src/lxml/tests/test_builder.py b/src/lxml/tests/test_builder.py +index b1ad4ebf6..15f17dfd5 100644 +--- a/src/lxml/tests/test_builder.py ++++ b/src/lxml/tests/test_builder.py +@@ -62,7 +62,7 @@ def test_qname_tag_default_namespace(self): + + def test_suite(): + suite = unittest.TestSuite() +- suite.addTests([unittest.makeSuite(BuilderTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(BuilderTestCase)]) + return suite + + if __name__ == '__main__': +diff --git a/src/lxml/tests/test_classlookup.py b/src/lxml/tests/test_classlookup.py +index 7c871d511..c88ce2879 100644 +--- a/src/lxml/tests/test_classlookup.py ++++ b/src/lxml/tests/test_classlookup.py +@@ -394,8 +394,8 @@ def custom(self): + + def test_suite(): + suite = unittest.TestSuite() +- suite.addTests([unittest.makeSuite(ProxyTestCase)]) +- suite.addTests([unittest.makeSuite(ClassLookupTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ProxyTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ClassLookupTestCase)]) + return suite + + if __name__ == '__main__': +diff --git a/src/lxml/tests/test_css.py b/src/lxml/tests/test_css.py +index e2afa65c7..3f1ca8787 100644 +--- a/src/lxml/tests/test_css.py ++++ b/src/lxml/tests/test_css.py +@@ -64,5 +64,5 @@ def test_suite(): + + import lxml.cssselect + suite.addTests(doctest.DocTestSuite(lxml.cssselect)) +- suite.addTests([unittest.makeSuite(CSSTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(CSSTestCase)]) + return suite +diff --git a/src/lxml/tests/test_doctestcompare.py b/src/lxml/tests/test_doctestcompare.py +index 366328124..636e6b5f6 100644 +--- a/src/lxml/tests/test_doctestcompare.py ++++ b/src/lxml/tests/test_doctestcompare.py +@@ -125,7 +125,7 @@ def test_missing_attributes(self): + + def test_suite(): + suite = unittest.TestSuite() +- suite.addTests([unittest.makeSuite(DoctestCompareTest)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(DoctestCompareTest)]) + return suite + + +diff --git a/src/lxml/tests/test_dtd.py b/src/lxml/tests/test_dtd.py +index 5c9b1c024..cbb1b402e 100644 +--- a/src/lxml/tests/test_dtd.py ++++ b/src/lxml/tests/test_dtd.py +@@ -422,7 +422,7 @@ def test_entity_system_url_none(self): + + def test_suite(): + suite = unittest.TestSuite() +- suite.addTests([unittest.makeSuite(ETreeDtdTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeDtdTestCase)]) + suite.addTests( + [make_doctest('../../../doc/validation.txt')]) + return suite +diff --git a/src/lxml/tests/test_elementpath.py b/src/lxml/tests/test_elementpath.py +index 1793ff821..0bb481c87 100644 +--- a/src/lxml/tests/test_elementpath.py ++++ b/src/lxml/tests/test_elementpath.py +@@ -293,8 +293,8 @@ def test_find(self): + + def test_suite(): + suite = unittest.TestSuite() +- suite.addTests([unittest.makeSuite(EtreeElementPathTestCase)]) +- #suite.addTests([unittest.makeSuite(ElementTreeElementPathTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(EtreeElementPathTestCase)]) ++ #suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ElementTreeElementPathTestCase)]) + return suite + + +diff --git a/src/lxml/tests/test_elementtree.py b/src/lxml/tests/test_elementtree.py +index 96426cba5..19c77a879 100644 +--- a/src/lxml/tests/test_elementtree.py ++++ b/src/lxml/tests/test_elementtree.py +@@ -4992,22 +4992,22 @@ class CElementTreeElementSlicingTest(_ElementSlicingTest): + def test_suite(): + suite = unittest.TestSuite() + if etree: +- suite.addTests([unittest.makeSuite(ETreeTestCase)]) +- suite.addTests([unittest.makeSuite(ETreePullTestCase)]) +- suite.addTests([unittest.makeSuite(ETreeElementSlicingTest)]) +- suite.addTests([unittest.makeSuite(ETreeC14NTest)]) +- suite.addTests([unittest.makeSuite(ETreeC14N2WriteTest)]) +- suite.addTests([unittest.makeSuite(ETreeC14N2TostringTest)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreePullTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeElementSlicingTest)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeC14NTest)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeC14N2WriteTest)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeC14N2TostringTest)]) + if ElementTree: +- suite.addTests([unittest.makeSuite(ElementTreeTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ElementTreeTestCase)]) + if ElementTreePullTestCase: +- suite.addTests([unittest.makeSuite(ElementTreePullTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ElementTreePullTestCase)]) + if ElementTreeC14NTest: +- suite.addTests([unittest.makeSuite(ElementTreeC14NTest)]) +- suite.addTests([unittest.makeSuite(ElementTreeElementSlicingTest)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ElementTreeC14NTest)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ElementTreeElementSlicingTest)]) + if cElementTree: +- suite.addTests([unittest.makeSuite(CElementTreeTestCase)]) +- suite.addTests([unittest.makeSuite(CElementTreeElementSlicingTest)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(CElementTreeTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(CElementTreeElementSlicingTest)]) + return suite + + if __name__ == '__main__': +diff --git a/src/lxml/tests/test_errors.py b/src/lxml/tests/test_errors.py +index c0aee7449..7b0ad7126 100644 +--- a/src/lxml/tests/test_errors.py ++++ b/src/lxml/tests/test_errors.py +@@ -70,7 +70,7 @@ def test_xmlsyntaxerror_has_info(self): + + def test_suite(): + suite = unittest.TestSuite() +- suite.addTests([unittest.makeSuite(ErrorTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ErrorTestCase)]) + return suite + + if __name__ == '__main__': +diff --git a/src/lxml/tests/test_etree.py b/src/lxml/tests/test_etree.py +index 0118d0fc3..f01f04fcd 100644 +--- a/src/lxml/tests/test_etree.py ++++ b/src/lxml/tests/test_etree.py +@@ -5580,13 +5580,13 @@ def end(self, tag): + + def test_suite(): + suite = unittest.TestSuite() +- suite.addTests([unittest.makeSuite(ETreeOnlyTestCase)]) +- suite.addTests([unittest.makeSuite(ETreeXIncludeTestCase)]) +- suite.addTests([unittest.makeSuite(ElementIncludeTestCase)]) +- suite.addTests([unittest.makeSuite(ETreeC14NTestCase)]) +- suite.addTests([unittest.makeSuite(ETreeWriteTestCase)]) +- suite.addTests([unittest.makeSuite(ETreeErrorLogTest)]) +- suite.addTests([unittest.makeSuite(XMLPullParserTest)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeOnlyTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeXIncludeTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ElementIncludeTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeC14NTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeWriteTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeErrorLogTest)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(XMLPullParserTest)]) + + # add original doctests from ElementTree selftest modules + from . import selftest, selftest2 +diff --git a/src/lxml/tests/test_external_document.py b/src/lxml/tests/test_external_document.py +index 0d1d0639b..9826a2781 100644 +--- a/src/lxml/tests/test_external_document.py ++++ b/src/lxml/tests/test_external_document.py +@@ -98,7 +98,7 @@ def test_external_document_adoption(self): + def test_suite(): + suite = unittest.TestSuite() + if sys.platform != 'win32': +- suite.addTests([unittest.makeSuite(ExternalDocumentTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ExternalDocumentTestCase)]) + return suite + + +diff --git a/src/lxml/tests/test_htmlparser.py b/src/lxml/tests/test_htmlparser.py +index 2f3186ff1..53bb8f9d4 100644 +--- a/src/lxml/tests/test_htmlparser.py ++++ b/src/lxml/tests/test_htmlparser.py +@@ -679,7 +679,7 @@ def test_xhtml_as_html_as_xml(self): + + def test_suite(): + suite = unittest.TestSuite() +- suite.addTests([unittest.makeSuite(HtmlParserTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(HtmlParserTestCase)]) + return suite + + +diff --git a/src/lxml/tests/test_http_io.py b/src/lxml/tests/test_http_io.py +index 07f274231..652261391 100644 +--- a/src/lxml/tests/test_http_io.py ++++ b/src/lxml/tests/test_http_io.py +@@ -117,7 +117,7 @@ def handler(environ, start_response): + + def test_suite(): + suite = unittest.TestSuite() +- suite.addTests([unittest.makeSuite(HttpIOTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(HttpIOTestCase)]) + return suite + + +diff --git a/src/lxml/tests/test_incremental_xmlfile.py b/src/lxml/tests/test_incremental_xmlfile.py +index ddf81652a..f2cca7d6b 100644 +--- a/src/lxml/tests/test_incremental_xmlfile.py ++++ b/src/lxml/tests/test_incremental_xmlfile.py +@@ -660,12 +660,12 @@ async def generate(out, close=True, buffered=True): + def test_suite(): + suite = unittest.TestSuite() + suite.addTests([ +- unittest.makeSuite(BytesIOXmlFileTestCase), +- unittest.makeSuite(TempXmlFileTestCase), +- unittest.makeSuite(TempPathXmlFileTestCase), +- unittest.makeSuite(SimpleFileLikeXmlFileTestCase), +- unittest.makeSuite(HtmlFileTestCase), +- unittest.makeSuite(AsyncXmlFileTestCase), ++ unittest.defaultTestLoader.loadTestsFromTestCase(BytesIOXmlFileTestCase), ++ unittest.defaultTestLoader.loadTestsFromTestCase(TempXmlFileTestCase), ++ unittest.defaultTestLoader.loadTestsFromTestCase(TempPathXmlFileTestCase), ++ unittest.defaultTestLoader.loadTestsFromTestCase(SimpleFileLikeXmlFileTestCase), ++ unittest.defaultTestLoader.loadTestsFromTestCase(HtmlFileTestCase), ++ unittest.defaultTestLoader.loadTestsFromTestCase(AsyncXmlFileTestCase), + ]) + return suite + +diff --git a/src/lxml/tests/test_io.py b/src/lxml/tests/test_io.py +index cbdbcef06..c45ce45a2 100644 +--- a/src/lxml/tests/test_io.py ++++ b/src/lxml/tests/test_io.py +@@ -363,9 +363,9 @@ class ElementTreeIOTestCase(_IOTestCaseBase): + + def test_suite(): + suite = unittest.TestSuite() +- suite.addTests([unittest.makeSuite(ETreeIOTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeIOTestCase)]) + if ElementTree: +- suite.addTests([unittest.makeSuite(ElementTreeIOTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ElementTreeIOTestCase)]) + return suite + + +diff --git a/src/lxml/tests/test_isoschematron.py b/src/lxml/tests/test_isoschematron.py +index bf8a7d27f..ccc4baecc 100644 +--- a/src/lxml/tests/test_isoschematron.py ++++ b/src/lxml/tests/test_isoschematron.py +@@ -862,7 +862,7 @@ def test_schematron_fail_on_report(self): + + def test_suite(): + suite = unittest.TestSuite() +- suite.addTests([unittest.makeSuite(ETreeISOSchematronTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeISOSchematronTestCase)]) + suite.addTests(doctest.DocTestSuite(isoschematron)) + suite.addTests( + [make_doctest('../../../doc/validation.txt')]) +diff --git a/src/lxml/tests/test_nsclasses.py b/src/lxml/tests/test_nsclasses.py +index a0aa608d7..b9e623f38 100644 +--- a/src/lxml/tests/test_nsclasses.py ++++ b/src/lxml/tests/test_nsclasses.py +@@ -203,7 +203,7 @@ class honk(etree.ElementBase): + + def test_suite(): + suite = unittest.TestSuite() +- suite.addTests([unittest.makeSuite(ETreeNamespaceClassesTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeNamespaceClassesTestCase)]) + suite.addTests( + [make_doctest('../../../doc/element_classes.txt')]) + return suite +diff --git a/src/lxml/tests/test_objectify.py b/src/lxml/tests/test_objectify.py +index 15b1c6887..1f1f93d08 100644 +--- a/src/lxml/tests/test_objectify.py ++++ b/src/lxml/tests/test_objectify.py +@@ -2744,7 +2744,7 @@ def space(_choice=random.choice): + + def test_suite(): + suite = unittest.TestSuite() +- suite.addTests([unittest.makeSuite(ObjectifyTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ObjectifyTestCase)]) + suite.addTests(doctest.DocTestSuite(objectify)) + suite.addTests([make_doctest('../../../doc/objectify.txt')]) + return suite +diff --git a/src/lxml/tests/test_pyclasslookup.py b/src/lxml/tests/test_pyclasslookup.py +index d650870a5..c5b161527 100644 +--- a/src/lxml/tests/test_pyclasslookup.py ++++ b/src/lxml/tests/test_pyclasslookup.py +@@ -344,7 +344,7 @@ def return_none(*args): + + def test_suite(): + suite = unittest.TestSuite() +- suite.addTests([unittest.makeSuite(PyClassLookupTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(PyClassLookupTestCase)]) + return suite + + if __name__ == '__main__': +diff --git a/src/lxml/tests/test_relaxng.py b/src/lxml/tests/test_relaxng.py +index 3c589c18a..7e7f1719d 100644 +--- a/src/lxml/tests/test_relaxng.py ++++ b/src/lxml/tests/test_relaxng.py +@@ -249,11 +249,11 @@ def test_relaxng_compact_str(self): + + def test_suite(): + suite = unittest.TestSuite() +- suite.addTests([unittest.makeSuite(ETreeRelaxNGTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeRelaxNGTestCase)]) + suite.addTests( + [make_doctest('../../../doc/validation.txt')]) + if rnc2rng is not None: +- suite.addTests([unittest.makeSuite(RelaxNGCompactTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(RelaxNGCompactTestCase)]) + return suite + + if __name__ == '__main__': +diff --git a/src/lxml/tests/test_sax.py b/src/lxml/tests/test_sax.py +index 2ed1e5135..9a2e08262 100644 +--- a/src/lxml/tests/test_sax.py ++++ b/src/lxml/tests/test_sax.py +@@ -405,8 +405,8 @@ def test_element_sax_twin_ns_prefix(self): + + def test_suite(): + suite = unittest.TestSuite() +- suite.addTests([unittest.makeSuite(ETreeSaxTestCase)]) +- suite.addTests([unittest.makeSuite(NSPrefixSaxTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeSaxTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(NSPrefixSaxTestCase)]) + suite.addTests( + [make_doctest('../../../doc/sax.txt')]) + return suite +diff --git a/src/lxml/tests/test_schematron.py b/src/lxml/tests/test_schematron.py +index 2096346e3..c1c22e6c7 100644 +--- a/src/lxml/tests/test_schematron.py ++++ b/src/lxml/tests/test_schematron.py +@@ -73,7 +73,7 @@ def test_schematron_invalid_schema_namespace(self): + + def test_suite(): + suite = unittest.TestSuite() +- suite.addTests([unittest.makeSuite(ETreeSchematronTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeSchematronTestCase)]) + suite.addTests( + [make_doctest('../../../doc/validation.txt')]) + return suite +diff --git a/src/lxml/tests/test_threading.py b/src/lxml/tests/test_threading.py +index 2a16858b1..906db7f70 100644 +--- a/src/lxml/tests/test_threading.py ++++ b/src/lxml/tests/test_threading.py +@@ -582,8 +582,8 @@ def test_thread_pipeline_global_parse(self): + + def test_suite(): + suite = unittest.TestSuite() +- suite.addTests([unittest.makeSuite(ThreadingTestCase)]) +- suite.addTests([unittest.makeSuite(ThreadPipelineTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ThreadingTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ThreadPipelineTestCase)]) + return suite + + if __name__ == '__main__': +diff --git a/src/lxml/tests/test_unicode.py b/src/lxml/tests/test_unicode.py +index 287a0f0f7..6d4ee9c0f 100644 +--- a/src/lxml/tests/test_unicode.py ++++ b/src/lxml/tests/test_unicode.py +@@ -207,6 +207,6 @@ def test_utf32BE_fromstring(self): + + def test_suite(): + suite = unittest.TestSuite() +- suite.addTests([unittest.makeSuite(UnicodeTestCase)]) +- suite.addTests([unittest.makeSuite(EncodingsTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(UnicodeTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(EncodingsTestCase)]) + return suite +diff --git a/src/lxml/tests/test_xmlschema.py b/src/lxml/tests/test_xmlschema.py +index dbfc251a5..739dde463 100644 +--- a/src/lxml/tests/test_xmlschema.py ++++ b/src/lxml/tests/test_xmlschema.py +@@ -499,8 +499,8 @@ def resolve(self, url, id, context): + + def test_suite(): + suite = unittest.TestSuite() +- suite.addTests([unittest.makeSuite(ETreeXMLSchemaTestCase)]) +- suite.addTests([unittest.makeSuite(ETreeXMLSchemaResolversTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeXMLSchemaTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeXMLSchemaResolversTestCase)]) + suite.addTests( + [make_doctest('../../../doc/validation.txt')]) + return suite +diff --git a/src/lxml/tests/test_xpathevaluator.py b/src/lxml/tests/test_xpathevaluator.py +index 13ee97ece..ece23095f 100644 +--- a/src/lxml/tests/test_xpathevaluator.py ++++ b/src/lxml/tests/test_xpathevaluator.py +@@ -734,11 +734,11 @@ def xpath(): + + def test_suite(): + suite = unittest.TestSuite() +- suite.addTests([unittest.makeSuite(ETreeXPathTestCase)]) +- suite.addTests([unittest.makeSuite(ETreeXPathClassTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeXPathTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeXPathClassTestCase)]) + if etree.LIBXSLT_COMPILED_VERSION >= (1,1,25): +- suite.addTests([unittest.makeSuite(ETreeXPathExsltTestCase)]) +- suite.addTests([unittest.makeSuite(ETreeETXPathClassTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeXPathExsltTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeETXPathClassTestCase)]) + suite.addTests([doctest.DocTestSuite()]) + suite.addTests( + [make_doctest('../../../doc/xpathxslt.txt')]) +diff --git a/src/lxml/tests/test_xslt.py b/src/lxml/tests/test_xslt.py +index 84c1983fd..7ef0bb783 100644 +--- a/src/lxml/tests/test_xslt.py ++++ b/src/lxml/tests/test_xslt.py +@@ -2090,12 +2090,12 @@ def test_xslt_result_memoryview(self): + + def test_suite(): + suite = unittest.TestSuite() +- suite.addTests([unittest.makeSuite(ETreeXSLTTestCase)]) +- suite.addTests([unittest.makeSuite(ETreeEXSLTTestCase)]) +- suite.addTests([unittest.makeSuite(ETreeXSLTExtFuncTestCase)]) +- suite.addTests([unittest.makeSuite(ETreeXSLTExtElementTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeXSLTTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeEXSLTTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeXSLTExtFuncTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeXSLTExtElementTestCase)]) + if is_python3: +- suite.addTests([unittest.makeSuite(Py3XSLTTestCase)]) ++ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(Py3XSLTTestCase)]) + suite.addTests( + [make_doctest('../../../doc/extensions.txt')]) + suite.addTests( diff --git a/98025653e182f9203189cbde0ab2d6ebec556db8.patch b/98025653e182f9203189cbde0ab2d6ebec556db8.patch new file mode 100644 index 0000000..fc7e5dc --- /dev/null +++ b/98025653e182f9203189cbde0ab2d6ebec556db8.patch @@ -0,0 +1,47 @@ +From 98025653e182f9203189cbde0ab2d6ebec556db8 Mon Sep 17 00:00:00 2001 +From: Stefan Behnel +Date: Tue, 31 Oct 2023 12:07:30 +0100 +Subject: [PATCH] Fix doctest in Py3.13. + +--- + src/lxml/tests/test_xpathevaluator.py | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/src/lxml/tests/test_xpathevaluator.py b/src/lxml/tests/test_xpathevaluator.py +index ece23095f..8bc453e50 100644 +--- a/src/lxml/tests/test_xpathevaluator.py ++++ b/src/lxml/tests/test_xpathevaluator.py +@@ -687,15 +687,15 @@ def resultTypesTest2(ctxt): + (None, 'resultTypesTest2'): resultTypesTest2,} + + def xpath(): +- """ ++ u""" + Test xpath extension functions. + + >>> root = SAMPLE_XML + >>> e = etree.XPathEvaluator(root, extensions=[extension]) + >>> e("stringTest('you')") + 'Hello you' +- >>> e(_bytes("stringTest('\\\\xe9lan')").decode("unicode_escape")) +- u'Hello \\xe9lan' ++ >>> print(e(_bytes("stringTest('\\\\xe9lan')").decode("unicode_escape"))) ++ Hello \xe9lan + >>> e("stringTest('you','there')") #doctest: +ELLIPSIS + Traceback (most recent call last): + ... +@@ -714,10 +714,10 @@ def xpath(): + "a, 1.5, True, ['tag', 'tag', 'tag']" + >>> list(map(tag, e("argsTest2(/body/tag, /body/section)"))) + ['tag', 'section', 'tag', 'tag'] +- >>> e("resultTypesTest()") +- Traceback (most recent call last): +- ... +- XPathResultError: This is not a supported node-set result: None ++ >>> try: e("resultTypesTest()") ++ ... except etree.XPathResultError as exc: print(exc) ++ ... else: print("SHOULD HAVE FAILED!") ++ This is not a supported node-set result: None + >>> try: + ... e("resultTypesTest2()") + ... except etree.XPathResultError: diff --git a/python-lxml.spec b/python-lxml.spec index 7b713b0..9788db5 100644 --- a/python-lxml.spec +++ b/python-lxml.spec @@ -31,6 +31,10 @@ Patch: Skip-failing-test-test_html_prefix_nsmap.patch Patch: https://github.com/lxml/lxml/commit/dcbc0cc1cb0cedf8019184aaca805d2a649cd8de.patch Patch: https://github.com/lxml/lxml/commit/a03a4b3c6b906d33c5ef1a15f3d5ca5fff600c76.patch +# Python 3.13 compatibility +Patch: https://github.com/lxml/lxml/commit/34187968a67151f02db491a56a0037b55319931d.patch +Patch: https://github.com/lxml/lxml/commit/98025653e182f9203189cbde0ab2d6ebec556db8.patch + BuildRequires: gcc BuildRequires: libxml2-devel BuildRequires: libxslt-devel From e20963f4cfab4eb894bde4ead531ae651781b87d Mon Sep 17 00:00:00 2001 From: David King Date: Sun, 26 Nov 2023 20:56:01 +0000 Subject: [PATCH 18/47] Fix building against libxml2 2.12.0 Resolves https://bugzilla.redhat.com/show_bug.cgi?id=2250838 --- ...70566ab57d601abc7c2f49a8051b9d97b64c.patch | 41 +++++++++++++++++++ python-lxml.spec | 9 +++- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 2a6770566ab57d601abc7c2f49a8051b9d97b64c.patch diff --git a/2a6770566ab57d601abc7c2f49a8051b9d97b64c.patch b/2a6770566ab57d601abc7c2f49a8051b9d97b64c.patch new file mode 100644 index 0000000..4bc4de4 --- /dev/null +++ b/2a6770566ab57d601abc7c2f49a8051b9d97b64c.patch @@ -0,0 +1,41 @@ +From 2a6770566ab57d601abc7c2f49a8051b9d97b64c Mon Sep 17 00:00:00 2001 +From: Nick Wellnhofer +Date: Tue, 31 Oct 2023 12:36:02 +0100 +Subject: [PATCH] Make Unicode recovery test work with libxml2 2.12 (GH-383) + +When encountering encoding errors, libxml2 no longer switches to ISO-8859-1 since version 2.12. +--- + src/lxml/parser.pxi | 2 +- + src/lxml/tests/test_unicode.py | 6 +++++- + 2 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/src/lxml/parser.pxi b/src/lxml/parser.pxi +index 4b7b52065..8ceec7d25 100644 +--- a/src/lxml/parser.pxi ++++ b/src/lxml/parser.pxi +@@ -693,7 +693,7 @@ cdef xmlDoc* _handleParseResult(_ParserContext context, + # An encoding error occurred and libxml2 switched from UTF-8 + # input to (undecoded) Latin-1, at some arbitrary point in the + # document. Better raise an error than allowing for a broken +- # tree with mixed encodings. ++ # tree with mixed encodings. This is fixed in libxml2 2.12. + well_formed = 0 + elif recover or (c_ctxt.wellFormed and + c_ctxt.lastError.level < xmlerror.XML_ERR_ERROR): +diff --git a/src/lxml/tests/test_unicode.py b/src/lxml/tests/test_unicode.py +index 6d4ee9c0f..3636539b2 100644 +--- a/src/lxml/tests/test_unicode.py ++++ b/src/lxml/tests/test_unicode.py +@@ -167,7 +167,11 @@ def test_illegal_utf8(self): + def test_illegal_utf8_recover(self): + data = _bytes('\x80\x80\x80', encoding='iso8859-1') + parser = etree.XMLParser(recover=True) +- self.assertRaises(etree.XMLSyntaxError, etree.fromstring, data, parser) ++ if etree.LIBXML_VERSION >= (2, 12, 0): ++ tree = etree.fromstring(data, parser) ++ self.assertEqual('\ufffd\ufffd\ufffd', tree.text) ++ else: ++ self.assertRaises(etree.XMLSyntaxError, etree.fromstring, data, parser) + + def _test_encoding(self, encoding, xml_encoding_name=None): + foo = """\n""" % ( diff --git a/python-lxml.spec b/python-lxml.spec index 9788db5..bf9ea81 100644 --- a/python-lxml.spec +++ b/python-lxml.spec @@ -1,6 +1,6 @@ Name: python-lxml Version: 4.9.3 -Release: 3%{?dist} +Release: 4%{?dist} Summary: XML processing library combining libxml2/libxslt with the ElementTree API # The lxml project is licensed under BSD-3-Clause @@ -35,6 +35,9 @@ Patch: https://github.com/lxml/lxml/commit/a03a4b3c6b906d33c5ef1a15f3d5 Patch: https://github.com/lxml/lxml/commit/34187968a67151f02db491a56a0037b55319931d.patch Patch: https://github.com/lxml/lxml/commit/98025653e182f9203189cbde0ab2d6ebec556db8.patch +# libxml2 2.12.0 Unicode test compatibility +Patch: https://github.com/lxml/lxml/commit/2a6770566ab57d601abc7c2f49a8051b9d97b64c.patch + BuildRequires: gcc BuildRequires: libxml2-devel BuildRequires: libxslt-devel @@ -104,6 +107,10 @@ cp -a build/lib.%{python3_platform}-*/* src/ %doc README.rst %changelog +* Sun Nov 26 2023 David King - 4.9.3-4 +- Fix building against libxml2 2.12.0 +- Resolves: rhbz#2250838 + * Mon Oct 30 2023 Miro Hrončok - 4.9.3-3 - Fix build with a future mock version From 63254d5e35fb70ee790ec6f395d281118195dadc Mon Sep 17 00:00:00 2001 From: Lumir Balhar Date: Wed, 20 Dec 2023 13:41:58 +0100 Subject: [PATCH 19/47] Update to 4.9.4 (rhbz#2255267) --- .gitignore | 1 + ...70566ab57d601abc7c2f49a8051b9d97b64c.patch | 41 ------------------- ...ion-of-ISO-Schematron-files-optional.patch | 28 ++++++------- python-lxml.spec | 13 +++--- sources | 2 +- 5 files changed, 22 insertions(+), 63 deletions(-) delete mode 100644 2a6770566ab57d601abc7c2f49a8051b9d97b64c.patch diff --git a/.gitignore b/.gitignore index b381b1f..2c2d10b 100644 --- a/.gitignore +++ b/.gitignore @@ -62,3 +62,4 @@ lxml-2.2.7.tar.gz.asc /lxml-4.9.2-no-isoschematron.tar.gz /lxml-4.9.2-no-isoschematron-rng.tar.gz /lxml-4.9.3-no-isoschematron-rng.tar.gz +/lxml-4.9.4-no-isoschematron-rng.tar.gz diff --git a/2a6770566ab57d601abc7c2f49a8051b9d97b64c.patch b/2a6770566ab57d601abc7c2f49a8051b9d97b64c.patch deleted file mode 100644 index 4bc4de4..0000000 --- a/2a6770566ab57d601abc7c2f49a8051b9d97b64c.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 2a6770566ab57d601abc7c2f49a8051b9d97b64c Mon Sep 17 00:00:00 2001 -From: Nick Wellnhofer -Date: Tue, 31 Oct 2023 12:36:02 +0100 -Subject: [PATCH] Make Unicode recovery test work with libxml2 2.12 (GH-383) - -When encountering encoding errors, libxml2 no longer switches to ISO-8859-1 since version 2.12. ---- - src/lxml/parser.pxi | 2 +- - src/lxml/tests/test_unicode.py | 6 +++++- - 2 files changed, 6 insertions(+), 2 deletions(-) - -diff --git a/src/lxml/parser.pxi b/src/lxml/parser.pxi -index 4b7b52065..8ceec7d25 100644 ---- a/src/lxml/parser.pxi -+++ b/src/lxml/parser.pxi -@@ -693,7 +693,7 @@ cdef xmlDoc* _handleParseResult(_ParserContext context, - # An encoding error occurred and libxml2 switched from UTF-8 - # input to (undecoded) Latin-1, at some arbitrary point in the - # document. Better raise an error than allowing for a broken -- # tree with mixed encodings. -+ # tree with mixed encodings. This is fixed in libxml2 2.12. - well_formed = 0 - elif recover or (c_ctxt.wellFormed and - c_ctxt.lastError.level < xmlerror.XML_ERR_ERROR): -diff --git a/src/lxml/tests/test_unicode.py b/src/lxml/tests/test_unicode.py -index 6d4ee9c0f..3636539b2 100644 ---- a/src/lxml/tests/test_unicode.py -+++ b/src/lxml/tests/test_unicode.py -@@ -167,7 +167,11 @@ def test_illegal_utf8(self): - def test_illegal_utf8_recover(self): - data = _bytes('\x80\x80\x80', encoding='iso8859-1') - parser = etree.XMLParser(recover=True) -- self.assertRaises(etree.XMLSyntaxError, etree.fromstring, data, parser) -+ if etree.LIBXML_VERSION >= (2, 12, 0): -+ tree = etree.fromstring(data, parser) -+ self.assertEqual('\ufffd\ufffd\ufffd', tree.text) -+ else: -+ self.assertRaises(etree.XMLSyntaxError, etree.fromstring, data, parser) - - def _test_encoding(self, encoding, xml_encoding_name=None): - foo = """\n""" % ( diff --git a/Make-the-validation-of-ISO-Schematron-files-optional.patch b/Make-the-validation-of-ISO-Schematron-files-optional.patch index 3bc8132..3befac0 100644 --- a/Make-the-validation-of-ISO-Schematron-files-optional.patch +++ b/Make-the-validation-of-ISO-Schematron-files-optional.patch @@ -1,28 +1,25 @@ -From a500f721e3b34018f0a86af275427663dc337b5a Mon Sep 17 00:00:00 2001 +From 07b3e9915972be02fbe98ab68ac052136ea94e27 Mon Sep 17 00:00:00 2001 From: Stefan Behnel -Date: Wed, 12 Jul 2023 16:59:07 +0200 +Date: Wed, 20 Dec 2023 12:53:02 +0100 Subject: [PATCH] Make the validation of ISO-Schematron files optional in lxml, - depending on the availability of the RNG validation file. Some lxml + depending on the availability of the RNG validation file. Some lxml distributions discard the validation schema file due to licensing issues. See https://bugs.launchpad.net/lxml/+bug/2024343 --- - CHANGES.txt | 11 +++++++++++ + CHANGES.txt | 7 +++++++ doc/validation.txt | 9 +++++++++ src/lxml/isoschematron/__init__.py | 24 +++++++++++++++++++----- - 3 files changed, 39 insertions(+), 5 deletions(-) + 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt -index 24052db..e68ee9a 100644 +index 4dd1055..90b3329 100644 --- a/CHANGES.txt +++ b/CHANGES.txt -@@ -2,6 +2,17 @@ - lxml changelog - ============== +@@ -49,6 +49,13 @@ Other changes + + * Built with Cython 0.29.36 to adapt to changes in Python 3.12. -+4.9.3+ -+====== -+ +* LP#2024343: The validation of the schema file itself is now optional in the + ISO-Schematron implementation. This was done because some lxml distributions + discard the RNG validation schema file due to licensing issues. The validation @@ -30,10 +27,9 @@ index 24052db..e68ee9a 100644 + It is enabled by default if available and disabled otherwise. The module + constant ``lxml.isoschematron.schematron_schema_valid_supported`` can be used + to detect whether schema file validation is available. -+ - 4.9.3 (2023-07-05) - ================== + 4.9.2 (2022-12-13) + ================== diff --git a/doc/validation.txt b/doc/validation.txt index af9d007..27c0ccd 100644 --- a/doc/validation.txt @@ -112,5 +108,5 @@ index 5967b10..2846a66 100644 "invalid schematron schema: %s" % schematron_schema_valid.error_log) -- -2.40.1 +2.43.0 diff --git a/python-lxml.spec b/python-lxml.spec index bf9ea81..3d87fe4 100644 --- a/python-lxml.spec +++ b/python-lxml.spec @@ -1,6 +1,6 @@ Name: python-lxml -Version: 4.9.3 -Release: 4%{?dist} +Version: 4.9.4 +Release: 1%{?dist} Summary: XML processing library combining libxml2/libxslt with the ElementTree API # The lxml project is licensed under BSD-3-Clause @@ -35,9 +35,6 @@ Patch: https://github.com/lxml/lxml/commit/a03a4b3c6b906d33c5ef1a15f3d5 Patch: https://github.com/lxml/lxml/commit/34187968a67151f02db491a56a0037b55319931d.patch Patch: https://github.com/lxml/lxml/commit/98025653e182f9203189cbde0ab2d6ebec556db8.patch -# libxml2 2.12.0 Unicode test compatibility -Patch: https://github.com/lxml/lxml/commit/2a6770566ab57d601abc7c2f49a8051b9d97b64c.patch - BuildRequires: gcc BuildRequires: libxml2-devel BuildRequires: libxslt-devel @@ -80,6 +77,9 @@ Python 3 version. # Don't run html5lib tests --without extras %{!?without_extras:rm src/lxml/html/tests/test_html5parser.py} +# Remove limit for version of Cython +sed -i "s/Cython.*/Cython/" requirements.txt + %generate_buildrequires %pyproject_buildrequires -x source%{?with_extras:,cssselect,html5,htmlsoup} @@ -107,6 +107,9 @@ cp -a build/lib.%{python3_platform}-*/* src/ %doc README.rst %changelog +* Wed Dec 20 2023 Lumír Balhar - 4.9.4-1 +- Update to 4.9.4 (rhbz#2255267) + * Sun Nov 26 2023 David King - 4.9.3-4 - Fix building against libxml2 2.12.0 - Resolves: rhbz#2250838 diff --git a/sources b/sources index b03cd14..4d0d50a 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (lxml-4.9.3-no-isoschematron-rng.tar.gz) = e3e289ad0aa4bec75fbdee5682d1047c2f98f48f9fd39571175f6a758a10ab2266ed4591bf9dcb65a387ee22cf9de4adac57997dca57b95e0bae07268aff33fe +SHA512 (lxml-4.9.4-no-isoschematron-rng.tar.gz) = 0519d6d58537d870fd862fa9f9256cca85162720eb417e2f532d000ab0faf25121b947746517c0a5df56c9d89e5cf5069a3a90f0fe116b2e6378329f2330c8ac From db11b56656cf9e4bda3327f5365fa2f1b1d78c3b Mon Sep 17 00:00:00 2001 From: Lumir Balhar Date: Mon, 8 Jan 2024 14:16:19 +0100 Subject: [PATCH 20/47] Update to 5.1.0 (rhbz#2256232) --- .gitignore | 1 + ...7968a67151f02db491a56a0037b55319931d.patch | 482 -------- 380.patch | 24 - ...5653e182f9203189cbde0ab2d6ebec556db8.patch | 47 - ...ion-of-ISO-Schematron-files-optional.patch | 112 -- ...-failing-test-test_html_prefix_nsmap.patch | 34 - ...4b3c6b906d33c5ef1a15f3d5ca5fff600c76.patch | 402 ------ ...0cc1cb0cedf8019184aaca805d2a649cd8de.patch | 1088 ----------------- python-lxml.spec | 25 +- sources | 2 +- 10 files changed, 7 insertions(+), 2210 deletions(-) delete mode 100644 34187968a67151f02db491a56a0037b55319931d.patch delete mode 100644 380.patch delete mode 100644 98025653e182f9203189cbde0ab2d6ebec556db8.patch delete mode 100644 Make-the-validation-of-ISO-Schematron-files-optional.patch delete mode 100644 Skip-failing-test-test_html_prefix_nsmap.patch delete mode 100644 a03a4b3c6b906d33c5ef1a15f3d5ca5fff600c76.patch delete mode 100644 dcbc0cc1cb0cedf8019184aaca805d2a649cd8de.patch diff --git a/.gitignore b/.gitignore index 2c2d10b..dfc2d49 100644 --- a/.gitignore +++ b/.gitignore @@ -63,3 +63,4 @@ lxml-2.2.7.tar.gz.asc /lxml-4.9.2-no-isoschematron-rng.tar.gz /lxml-4.9.3-no-isoschematron-rng.tar.gz /lxml-4.9.4-no-isoschematron-rng.tar.gz +/lxml-5.1.0-no-isoschematron-rng.tar.gz diff --git a/34187968a67151f02db491a56a0037b55319931d.patch b/34187968a67151f02db491a56a0037b55319931d.patch deleted file mode 100644 index 9a153b6..0000000 --- a/34187968a67151f02db491a56a0037b55319931d.patch +++ /dev/null @@ -1,482 +0,0 @@ -From 34187968a67151f02db491a56a0037b55319931d Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= -Date: Mon, 30 Oct 2023 20:21:55 +0100 -Subject: [PATCH] Avoid usage of unittest.makeSuite(), removed from Python 3.13 - (GH-385) - -Patch generated by: - - sed -i 's/unittest.makeSuite/unittest.defaultTestLoader.loadTestsFromTestCase/g' $(grep -rl makeSuite) ---- - src/lxml/html/tests/test_clean.py | 2 +- - src/lxml/html/tests/test_elementsoup.py | 2 +- - src/lxml/tests/test_builder.py | 2 +- - src/lxml/tests/test_classlookup.py | 4 ++-- - src/lxml/tests/test_css.py | 2 +- - src/lxml/tests/test_doctestcompare.py | 2 +- - src/lxml/tests/test_dtd.py | 2 +- - src/lxml/tests/test_elementpath.py | 4 ++-- - src/lxml/tests/test_elementtree.py | 24 +++++++++++----------- - src/lxml/tests/test_errors.py | 2 +- - src/lxml/tests/test_etree.py | 14 ++++++------- - src/lxml/tests/test_external_document.py | 2 +- - src/lxml/tests/test_htmlparser.py | 2 +- - src/lxml/tests/test_http_io.py | 2 +- - src/lxml/tests/test_incremental_xmlfile.py | 12 +++++------ - src/lxml/tests/test_io.py | 4 ++-- - src/lxml/tests/test_isoschematron.py | 2 +- - src/lxml/tests/test_nsclasses.py | 2 +- - src/lxml/tests/test_objectify.py | 2 +- - src/lxml/tests/test_pyclasslookup.py | 2 +- - src/lxml/tests/test_relaxng.py | 4 ++-- - src/lxml/tests/test_sax.py | 4 ++-- - src/lxml/tests/test_schematron.py | 2 +- - src/lxml/tests/test_threading.py | 4 ++-- - src/lxml/tests/test_unicode.py | 4 ++-- - src/lxml/tests/test_xmlschema.py | 4 ++-- - src/lxml/tests/test_xpathevaluator.py | 8 ++++---- - src/lxml/tests/test_xslt.py | 10 ++++----- - 28 files changed, 65 insertions(+), 65 deletions(-) - -diff --git a/src/lxml/html/tests/test_clean.py b/src/lxml/html/tests/test_clean.py -index ada0969bc..fe79f6d5b 100644 ---- a/src/lxml/html/tests/test_clean.py -+++ b/src/lxml/html/tests/test_clean.py -@@ -296,5 +296,5 @@ def test_suite(): - suite = unittest.TestSuite() - suite.addTests([make_doctest('test_clean.txt')]) - suite.addTests([make_doctest('test_clean_embed.txt')]) -- suite.addTests(unittest.makeSuite(CleanerTest)) -+ suite.addTests(unittest.defaultTestLoader.loadTestsFromTestCase(CleanerTest)) - return suite -diff --git a/src/lxml/html/tests/test_elementsoup.py b/src/lxml/html/tests/test_elementsoup.py -index 553586b9f..1fd9127a4 100644 ---- a/src/lxml/html/tests/test_elementsoup.py -+++ b/src/lxml/html/tests/test_elementsoup.py -@@ -118,7 +118,7 @@ def test_doctype_html5(self): - def test_suite(): - suite = unittest.TestSuite() - if BS_INSTALLED: -- suite.addTests([unittest.makeSuite(SoupParserTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(SoupParserTestCase)]) - if sys.version_info[0] < 3: - suite.addTests([make_doctest('../../../../doc/elementsoup.txt')]) - return suite -diff --git a/src/lxml/tests/test_builder.py b/src/lxml/tests/test_builder.py -index b1ad4ebf6..15f17dfd5 100644 ---- a/src/lxml/tests/test_builder.py -+++ b/src/lxml/tests/test_builder.py -@@ -62,7 +62,7 @@ def test_qname_tag_default_namespace(self): - - def test_suite(): - suite = unittest.TestSuite() -- suite.addTests([unittest.makeSuite(BuilderTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(BuilderTestCase)]) - return suite - - if __name__ == '__main__': -diff --git a/src/lxml/tests/test_classlookup.py b/src/lxml/tests/test_classlookup.py -index 7c871d511..c88ce2879 100644 ---- a/src/lxml/tests/test_classlookup.py -+++ b/src/lxml/tests/test_classlookup.py -@@ -394,8 +394,8 @@ def custom(self): - - def test_suite(): - suite = unittest.TestSuite() -- suite.addTests([unittest.makeSuite(ProxyTestCase)]) -- suite.addTests([unittest.makeSuite(ClassLookupTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ProxyTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ClassLookupTestCase)]) - return suite - - if __name__ == '__main__': -diff --git a/src/lxml/tests/test_css.py b/src/lxml/tests/test_css.py -index e2afa65c7..3f1ca8787 100644 ---- a/src/lxml/tests/test_css.py -+++ b/src/lxml/tests/test_css.py -@@ -64,5 +64,5 @@ def test_suite(): - - import lxml.cssselect - suite.addTests(doctest.DocTestSuite(lxml.cssselect)) -- suite.addTests([unittest.makeSuite(CSSTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(CSSTestCase)]) - return suite -diff --git a/src/lxml/tests/test_doctestcompare.py b/src/lxml/tests/test_doctestcompare.py -index 366328124..636e6b5f6 100644 ---- a/src/lxml/tests/test_doctestcompare.py -+++ b/src/lxml/tests/test_doctestcompare.py -@@ -125,7 +125,7 @@ def test_missing_attributes(self): - - def test_suite(): - suite = unittest.TestSuite() -- suite.addTests([unittest.makeSuite(DoctestCompareTest)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(DoctestCompareTest)]) - return suite - - -diff --git a/src/lxml/tests/test_dtd.py b/src/lxml/tests/test_dtd.py -index 5c9b1c024..cbb1b402e 100644 ---- a/src/lxml/tests/test_dtd.py -+++ b/src/lxml/tests/test_dtd.py -@@ -422,7 +422,7 @@ def test_entity_system_url_none(self): - - def test_suite(): - suite = unittest.TestSuite() -- suite.addTests([unittest.makeSuite(ETreeDtdTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeDtdTestCase)]) - suite.addTests( - [make_doctest('../../../doc/validation.txt')]) - return suite -diff --git a/src/lxml/tests/test_elementpath.py b/src/lxml/tests/test_elementpath.py -index 1793ff821..0bb481c87 100644 ---- a/src/lxml/tests/test_elementpath.py -+++ b/src/lxml/tests/test_elementpath.py -@@ -293,8 +293,8 @@ def test_find(self): - - def test_suite(): - suite = unittest.TestSuite() -- suite.addTests([unittest.makeSuite(EtreeElementPathTestCase)]) -- #suite.addTests([unittest.makeSuite(ElementTreeElementPathTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(EtreeElementPathTestCase)]) -+ #suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ElementTreeElementPathTestCase)]) - return suite - - -diff --git a/src/lxml/tests/test_elementtree.py b/src/lxml/tests/test_elementtree.py -index 96426cba5..19c77a879 100644 ---- a/src/lxml/tests/test_elementtree.py -+++ b/src/lxml/tests/test_elementtree.py -@@ -4992,22 +4992,22 @@ class CElementTreeElementSlicingTest(_ElementSlicingTest): - def test_suite(): - suite = unittest.TestSuite() - if etree: -- suite.addTests([unittest.makeSuite(ETreeTestCase)]) -- suite.addTests([unittest.makeSuite(ETreePullTestCase)]) -- suite.addTests([unittest.makeSuite(ETreeElementSlicingTest)]) -- suite.addTests([unittest.makeSuite(ETreeC14NTest)]) -- suite.addTests([unittest.makeSuite(ETreeC14N2WriteTest)]) -- suite.addTests([unittest.makeSuite(ETreeC14N2TostringTest)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreePullTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeElementSlicingTest)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeC14NTest)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeC14N2WriteTest)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeC14N2TostringTest)]) - if ElementTree: -- suite.addTests([unittest.makeSuite(ElementTreeTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ElementTreeTestCase)]) - if ElementTreePullTestCase: -- suite.addTests([unittest.makeSuite(ElementTreePullTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ElementTreePullTestCase)]) - if ElementTreeC14NTest: -- suite.addTests([unittest.makeSuite(ElementTreeC14NTest)]) -- suite.addTests([unittest.makeSuite(ElementTreeElementSlicingTest)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ElementTreeC14NTest)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ElementTreeElementSlicingTest)]) - if cElementTree: -- suite.addTests([unittest.makeSuite(CElementTreeTestCase)]) -- suite.addTests([unittest.makeSuite(CElementTreeElementSlicingTest)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(CElementTreeTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(CElementTreeElementSlicingTest)]) - return suite - - if __name__ == '__main__': -diff --git a/src/lxml/tests/test_errors.py b/src/lxml/tests/test_errors.py -index c0aee7449..7b0ad7126 100644 ---- a/src/lxml/tests/test_errors.py -+++ b/src/lxml/tests/test_errors.py -@@ -70,7 +70,7 @@ def test_xmlsyntaxerror_has_info(self): - - def test_suite(): - suite = unittest.TestSuite() -- suite.addTests([unittest.makeSuite(ErrorTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ErrorTestCase)]) - return suite - - if __name__ == '__main__': -diff --git a/src/lxml/tests/test_etree.py b/src/lxml/tests/test_etree.py -index 0118d0fc3..f01f04fcd 100644 ---- a/src/lxml/tests/test_etree.py -+++ b/src/lxml/tests/test_etree.py -@@ -5580,13 +5580,13 @@ def end(self, tag): - - def test_suite(): - suite = unittest.TestSuite() -- suite.addTests([unittest.makeSuite(ETreeOnlyTestCase)]) -- suite.addTests([unittest.makeSuite(ETreeXIncludeTestCase)]) -- suite.addTests([unittest.makeSuite(ElementIncludeTestCase)]) -- suite.addTests([unittest.makeSuite(ETreeC14NTestCase)]) -- suite.addTests([unittest.makeSuite(ETreeWriteTestCase)]) -- suite.addTests([unittest.makeSuite(ETreeErrorLogTest)]) -- suite.addTests([unittest.makeSuite(XMLPullParserTest)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeOnlyTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeXIncludeTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ElementIncludeTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeC14NTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeWriteTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeErrorLogTest)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(XMLPullParserTest)]) - - # add original doctests from ElementTree selftest modules - from . import selftest, selftest2 -diff --git a/src/lxml/tests/test_external_document.py b/src/lxml/tests/test_external_document.py -index 0d1d0639b..9826a2781 100644 ---- a/src/lxml/tests/test_external_document.py -+++ b/src/lxml/tests/test_external_document.py -@@ -98,7 +98,7 @@ def test_external_document_adoption(self): - def test_suite(): - suite = unittest.TestSuite() - if sys.platform != 'win32': -- suite.addTests([unittest.makeSuite(ExternalDocumentTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ExternalDocumentTestCase)]) - return suite - - -diff --git a/src/lxml/tests/test_htmlparser.py b/src/lxml/tests/test_htmlparser.py -index 2f3186ff1..53bb8f9d4 100644 ---- a/src/lxml/tests/test_htmlparser.py -+++ b/src/lxml/tests/test_htmlparser.py -@@ -679,7 +679,7 @@ def test_xhtml_as_html_as_xml(self): - - def test_suite(): - suite = unittest.TestSuite() -- suite.addTests([unittest.makeSuite(HtmlParserTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(HtmlParserTestCase)]) - return suite - - -diff --git a/src/lxml/tests/test_http_io.py b/src/lxml/tests/test_http_io.py -index 07f274231..652261391 100644 ---- a/src/lxml/tests/test_http_io.py -+++ b/src/lxml/tests/test_http_io.py -@@ -117,7 +117,7 @@ def handler(environ, start_response): - - def test_suite(): - suite = unittest.TestSuite() -- suite.addTests([unittest.makeSuite(HttpIOTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(HttpIOTestCase)]) - return suite - - -diff --git a/src/lxml/tests/test_incremental_xmlfile.py b/src/lxml/tests/test_incremental_xmlfile.py -index ddf81652a..f2cca7d6b 100644 ---- a/src/lxml/tests/test_incremental_xmlfile.py -+++ b/src/lxml/tests/test_incremental_xmlfile.py -@@ -660,12 +660,12 @@ async def generate(out, close=True, buffered=True): - def test_suite(): - suite = unittest.TestSuite() - suite.addTests([ -- unittest.makeSuite(BytesIOXmlFileTestCase), -- unittest.makeSuite(TempXmlFileTestCase), -- unittest.makeSuite(TempPathXmlFileTestCase), -- unittest.makeSuite(SimpleFileLikeXmlFileTestCase), -- unittest.makeSuite(HtmlFileTestCase), -- unittest.makeSuite(AsyncXmlFileTestCase), -+ unittest.defaultTestLoader.loadTestsFromTestCase(BytesIOXmlFileTestCase), -+ unittest.defaultTestLoader.loadTestsFromTestCase(TempXmlFileTestCase), -+ unittest.defaultTestLoader.loadTestsFromTestCase(TempPathXmlFileTestCase), -+ unittest.defaultTestLoader.loadTestsFromTestCase(SimpleFileLikeXmlFileTestCase), -+ unittest.defaultTestLoader.loadTestsFromTestCase(HtmlFileTestCase), -+ unittest.defaultTestLoader.loadTestsFromTestCase(AsyncXmlFileTestCase), - ]) - return suite - -diff --git a/src/lxml/tests/test_io.py b/src/lxml/tests/test_io.py -index cbdbcef06..c45ce45a2 100644 ---- a/src/lxml/tests/test_io.py -+++ b/src/lxml/tests/test_io.py -@@ -363,9 +363,9 @@ class ElementTreeIOTestCase(_IOTestCaseBase): - - def test_suite(): - suite = unittest.TestSuite() -- suite.addTests([unittest.makeSuite(ETreeIOTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeIOTestCase)]) - if ElementTree: -- suite.addTests([unittest.makeSuite(ElementTreeIOTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ElementTreeIOTestCase)]) - return suite - - -diff --git a/src/lxml/tests/test_isoschematron.py b/src/lxml/tests/test_isoschematron.py -index bf8a7d27f..ccc4baecc 100644 ---- a/src/lxml/tests/test_isoschematron.py -+++ b/src/lxml/tests/test_isoschematron.py -@@ -862,7 +862,7 @@ def test_schematron_fail_on_report(self): - - def test_suite(): - suite = unittest.TestSuite() -- suite.addTests([unittest.makeSuite(ETreeISOSchematronTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeISOSchematronTestCase)]) - suite.addTests(doctest.DocTestSuite(isoschematron)) - suite.addTests( - [make_doctest('../../../doc/validation.txt')]) -diff --git a/src/lxml/tests/test_nsclasses.py b/src/lxml/tests/test_nsclasses.py -index a0aa608d7..b9e623f38 100644 ---- a/src/lxml/tests/test_nsclasses.py -+++ b/src/lxml/tests/test_nsclasses.py -@@ -203,7 +203,7 @@ class honk(etree.ElementBase): - - def test_suite(): - suite = unittest.TestSuite() -- suite.addTests([unittest.makeSuite(ETreeNamespaceClassesTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeNamespaceClassesTestCase)]) - suite.addTests( - [make_doctest('../../../doc/element_classes.txt')]) - return suite -diff --git a/src/lxml/tests/test_objectify.py b/src/lxml/tests/test_objectify.py -index 15b1c6887..1f1f93d08 100644 ---- a/src/lxml/tests/test_objectify.py -+++ b/src/lxml/tests/test_objectify.py -@@ -2744,7 +2744,7 @@ def space(_choice=random.choice): - - def test_suite(): - suite = unittest.TestSuite() -- suite.addTests([unittest.makeSuite(ObjectifyTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ObjectifyTestCase)]) - suite.addTests(doctest.DocTestSuite(objectify)) - suite.addTests([make_doctest('../../../doc/objectify.txt')]) - return suite -diff --git a/src/lxml/tests/test_pyclasslookup.py b/src/lxml/tests/test_pyclasslookup.py -index d650870a5..c5b161527 100644 ---- a/src/lxml/tests/test_pyclasslookup.py -+++ b/src/lxml/tests/test_pyclasslookup.py -@@ -344,7 +344,7 @@ def return_none(*args): - - def test_suite(): - suite = unittest.TestSuite() -- suite.addTests([unittest.makeSuite(PyClassLookupTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(PyClassLookupTestCase)]) - return suite - - if __name__ == '__main__': -diff --git a/src/lxml/tests/test_relaxng.py b/src/lxml/tests/test_relaxng.py -index 3c589c18a..7e7f1719d 100644 ---- a/src/lxml/tests/test_relaxng.py -+++ b/src/lxml/tests/test_relaxng.py -@@ -249,11 +249,11 @@ def test_relaxng_compact_str(self): - - def test_suite(): - suite = unittest.TestSuite() -- suite.addTests([unittest.makeSuite(ETreeRelaxNGTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeRelaxNGTestCase)]) - suite.addTests( - [make_doctest('../../../doc/validation.txt')]) - if rnc2rng is not None: -- suite.addTests([unittest.makeSuite(RelaxNGCompactTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(RelaxNGCompactTestCase)]) - return suite - - if __name__ == '__main__': -diff --git a/src/lxml/tests/test_sax.py b/src/lxml/tests/test_sax.py -index 2ed1e5135..9a2e08262 100644 ---- a/src/lxml/tests/test_sax.py -+++ b/src/lxml/tests/test_sax.py -@@ -405,8 +405,8 @@ def test_element_sax_twin_ns_prefix(self): - - def test_suite(): - suite = unittest.TestSuite() -- suite.addTests([unittest.makeSuite(ETreeSaxTestCase)]) -- suite.addTests([unittest.makeSuite(NSPrefixSaxTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeSaxTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(NSPrefixSaxTestCase)]) - suite.addTests( - [make_doctest('../../../doc/sax.txt')]) - return suite -diff --git a/src/lxml/tests/test_schematron.py b/src/lxml/tests/test_schematron.py -index 2096346e3..c1c22e6c7 100644 ---- a/src/lxml/tests/test_schematron.py -+++ b/src/lxml/tests/test_schematron.py -@@ -73,7 +73,7 @@ def test_schematron_invalid_schema_namespace(self): - - def test_suite(): - suite = unittest.TestSuite() -- suite.addTests([unittest.makeSuite(ETreeSchematronTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeSchematronTestCase)]) - suite.addTests( - [make_doctest('../../../doc/validation.txt')]) - return suite -diff --git a/src/lxml/tests/test_threading.py b/src/lxml/tests/test_threading.py -index 2a16858b1..906db7f70 100644 ---- a/src/lxml/tests/test_threading.py -+++ b/src/lxml/tests/test_threading.py -@@ -582,8 +582,8 @@ def test_thread_pipeline_global_parse(self): - - def test_suite(): - suite = unittest.TestSuite() -- suite.addTests([unittest.makeSuite(ThreadingTestCase)]) -- suite.addTests([unittest.makeSuite(ThreadPipelineTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ThreadingTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ThreadPipelineTestCase)]) - return suite - - if __name__ == '__main__': -diff --git a/src/lxml/tests/test_unicode.py b/src/lxml/tests/test_unicode.py -index 287a0f0f7..6d4ee9c0f 100644 ---- a/src/lxml/tests/test_unicode.py -+++ b/src/lxml/tests/test_unicode.py -@@ -207,6 +207,6 @@ def test_utf32BE_fromstring(self): - - def test_suite(): - suite = unittest.TestSuite() -- suite.addTests([unittest.makeSuite(UnicodeTestCase)]) -- suite.addTests([unittest.makeSuite(EncodingsTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(UnicodeTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(EncodingsTestCase)]) - return suite -diff --git a/src/lxml/tests/test_xmlschema.py b/src/lxml/tests/test_xmlschema.py -index dbfc251a5..739dde463 100644 ---- a/src/lxml/tests/test_xmlschema.py -+++ b/src/lxml/tests/test_xmlschema.py -@@ -499,8 +499,8 @@ def resolve(self, url, id, context): - - def test_suite(): - suite = unittest.TestSuite() -- suite.addTests([unittest.makeSuite(ETreeXMLSchemaTestCase)]) -- suite.addTests([unittest.makeSuite(ETreeXMLSchemaResolversTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeXMLSchemaTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeXMLSchemaResolversTestCase)]) - suite.addTests( - [make_doctest('../../../doc/validation.txt')]) - return suite -diff --git a/src/lxml/tests/test_xpathevaluator.py b/src/lxml/tests/test_xpathevaluator.py -index 13ee97ece..ece23095f 100644 ---- a/src/lxml/tests/test_xpathevaluator.py -+++ b/src/lxml/tests/test_xpathevaluator.py -@@ -734,11 +734,11 @@ def xpath(): - - def test_suite(): - suite = unittest.TestSuite() -- suite.addTests([unittest.makeSuite(ETreeXPathTestCase)]) -- suite.addTests([unittest.makeSuite(ETreeXPathClassTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeXPathTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeXPathClassTestCase)]) - if etree.LIBXSLT_COMPILED_VERSION >= (1,1,25): -- suite.addTests([unittest.makeSuite(ETreeXPathExsltTestCase)]) -- suite.addTests([unittest.makeSuite(ETreeETXPathClassTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeXPathExsltTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeETXPathClassTestCase)]) - suite.addTests([doctest.DocTestSuite()]) - suite.addTests( - [make_doctest('../../../doc/xpathxslt.txt')]) -diff --git a/src/lxml/tests/test_xslt.py b/src/lxml/tests/test_xslt.py -index 84c1983fd..7ef0bb783 100644 ---- a/src/lxml/tests/test_xslt.py -+++ b/src/lxml/tests/test_xslt.py -@@ -2090,12 +2090,12 @@ def test_xslt_result_memoryview(self): - - def test_suite(): - suite = unittest.TestSuite() -- suite.addTests([unittest.makeSuite(ETreeXSLTTestCase)]) -- suite.addTests([unittest.makeSuite(ETreeEXSLTTestCase)]) -- suite.addTests([unittest.makeSuite(ETreeXSLTExtFuncTestCase)]) -- suite.addTests([unittest.makeSuite(ETreeXSLTExtElementTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeXSLTTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeEXSLTTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeXSLTExtFuncTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(ETreeXSLTExtElementTestCase)]) - if is_python3: -- suite.addTests([unittest.makeSuite(Py3XSLTTestCase)]) -+ suite.addTests([unittest.defaultTestLoader.loadTestsFromTestCase(Py3XSLTTestCase)]) - suite.addTests( - [make_doctest('../../../doc/extensions.txt')]) - suite.addTests( diff --git a/380.patch b/380.patch deleted file mode 100644 index daac445..0000000 --- a/380.patch +++ /dev/null @@ -1,24 +0,0 @@ -From d18f2f22218ea0e0b5327b5a2bda789afdf16e41 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= -Date: Fri, 14 Jul 2023 12:18:25 +0200 -Subject: [PATCH] Skip test_isoschematron.test_schematron_invalid_schema_empty - without the RNG file - -The expected SchematronParseError only happens when validate_schema is true. ---- - src/lxml/tests/test_isoschematron.py | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/src/lxml/tests/test_isoschematron.py b/src/lxml/tests/test_isoschematron.py -index 6d2aa3fb6..900f257c3 100644 ---- a/src/lxml/tests/test_isoschematron.py -+++ b/src/lxml/tests/test_isoschematron.py -@@ -55,6 +55,8 @@ def test_schematron_empty_pattern(self): - schema = isoschematron.Schematron(schema) - self.assertTrue(schema) - -+ @unittest.skipIf(not isoschematron.schematron_schema_valid_supported, -+ 'SchematronParseError is risen only when validate_schema is true') - def test_schematron_invalid_schema_empty(self): - schema = self.parse('''\ - diff --git a/98025653e182f9203189cbde0ab2d6ebec556db8.patch b/98025653e182f9203189cbde0ab2d6ebec556db8.patch deleted file mode 100644 index fc7e5dc..0000000 --- a/98025653e182f9203189cbde0ab2d6ebec556db8.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 98025653e182f9203189cbde0ab2d6ebec556db8 Mon Sep 17 00:00:00 2001 -From: Stefan Behnel -Date: Tue, 31 Oct 2023 12:07:30 +0100 -Subject: [PATCH] Fix doctest in Py3.13. - ---- - src/lxml/tests/test_xpathevaluator.py | 14 +++++++------- - 1 file changed, 7 insertions(+), 7 deletions(-) - -diff --git a/src/lxml/tests/test_xpathevaluator.py b/src/lxml/tests/test_xpathevaluator.py -index ece23095f..8bc453e50 100644 ---- a/src/lxml/tests/test_xpathevaluator.py -+++ b/src/lxml/tests/test_xpathevaluator.py -@@ -687,15 +687,15 @@ def resultTypesTest2(ctxt): - (None, 'resultTypesTest2'): resultTypesTest2,} - - def xpath(): -- """ -+ u""" - Test xpath extension functions. - - >>> root = SAMPLE_XML - >>> e = etree.XPathEvaluator(root, extensions=[extension]) - >>> e("stringTest('you')") - 'Hello you' -- >>> e(_bytes("stringTest('\\\\xe9lan')").decode("unicode_escape")) -- u'Hello \\xe9lan' -+ >>> print(e(_bytes("stringTest('\\\\xe9lan')").decode("unicode_escape"))) -+ Hello \xe9lan - >>> e("stringTest('you','there')") #doctest: +ELLIPSIS - Traceback (most recent call last): - ... -@@ -714,10 +714,10 @@ def xpath(): - "a, 1.5, True, ['tag', 'tag', 'tag']" - >>> list(map(tag, e("argsTest2(/body/tag, /body/section)"))) - ['tag', 'section', 'tag', 'tag'] -- >>> e("resultTypesTest()") -- Traceback (most recent call last): -- ... -- XPathResultError: This is not a supported node-set result: None -+ >>> try: e("resultTypesTest()") -+ ... except etree.XPathResultError as exc: print(exc) -+ ... else: print("SHOULD HAVE FAILED!") -+ This is not a supported node-set result: None - >>> try: - ... e("resultTypesTest2()") - ... except etree.XPathResultError: diff --git a/Make-the-validation-of-ISO-Schematron-files-optional.patch b/Make-the-validation-of-ISO-Schematron-files-optional.patch deleted file mode 100644 index 3befac0..0000000 --- a/Make-the-validation-of-ISO-Schematron-files-optional.patch +++ /dev/null @@ -1,112 +0,0 @@ -From 07b3e9915972be02fbe98ab68ac052136ea94e27 Mon Sep 17 00:00:00 2001 -From: Stefan Behnel -Date: Wed, 20 Dec 2023 12:53:02 +0100 -Subject: [PATCH] Make the validation of ISO-Schematron files optional in lxml, - depending on the availability of the RNG validation file. Some lxml - distributions discard the validation schema file due to licensing issues. - -See https://bugs.launchpad.net/lxml/+bug/2024343 ---- - CHANGES.txt | 7 +++++++ - doc/validation.txt | 9 +++++++++ - src/lxml/isoschematron/__init__.py | 24 +++++++++++++++++++----- - 3 files changed, 35 insertions(+), 5 deletions(-) - -diff --git a/CHANGES.txt b/CHANGES.txt -index 4dd1055..90b3329 100644 ---- a/CHANGES.txt -+++ b/CHANGES.txt -@@ -49,6 +49,13 @@ Other changes - - * Built with Cython 0.29.36 to adapt to changes in Python 3.12. - -+* LP#2024343: The validation of the schema file itself is now optional in the -+ ISO-Schematron implementation. This was done because some lxml distributions -+ discard the RNG validation schema file due to licensing issues. The validation -+ can now always be disabled with ``Schematron(..., validate_schema=False)``. -+ It is enabled by default if available and disabled otherwise. The module -+ constant ``lxml.isoschematron.schematron_schema_valid_supported`` can be used -+ to detect whether schema file validation is available. - - 4.9.2 (2022-12-13) - ================== -diff --git a/doc/validation.txt b/doc/validation.txt -index af9d007..27c0ccd 100644 ---- a/doc/validation.txt -+++ b/doc/validation.txt -@@ -615,6 +615,15 @@ The usage of validation phases is a unique feature of ISO-Schematron and can be - a very powerful tool e.g. for establishing validation stages or to provide - different validators for different "validation audiences". - -+Note: Some lxml distributions exclude the validation schema file due to licensing issues. -+Since lxml 4.9.2-8, the validation of the user provided schema can be disabled with -+``Schematron(..., validate_schema=False)``. -+It is enabled by default if available and disabled otherwise. Previous versions of -+lxml always had it enabled and failed at import time if the file was not available. -+Thus, some distributions chose to remove the entire ISO-Schematron support. -+The module constant ``lxml.isoschematron.schematron_schema_valid_supported`` can be used -+since lxml 4.9.2-8 to detect whether schema file validation is available. -+ - (Pre-ISO-Schematron) - -------------------- - -diff --git a/src/lxml/isoschematron/__init__.py b/src/lxml/isoschematron/__init__.py -index 5967b10..2846a66 100644 ---- a/src/lxml/isoschematron/__init__.py -+++ b/src/lxml/isoschematron/__init__.py -@@ -61,10 +61,16 @@ iso_svrl_for_xslt1 = _etree.XSLT(_etree.parse( - svrl_validation_errors = _etree.XPath( - '//svrl:failed-assert', namespaces={'svrl': SVRL_NS}) - -- - # RelaxNG validator for schematron schemas --schematron_schema_valid = _etree.RelaxNG( -- file=os.path.join(_resources_dir, 'rng', 'iso-schematron.rng')) -+schematron_schema_valid_supported = False -+try: -+ schematron_schema_valid = _etree.RelaxNG( -+ file=os.path.join(_resources_dir, 'rng', 'iso-schematron.rng')) -+ schematron_schema_valid_supported = True -+except _etree.RelaxNGParseError: -+ # Some distributions delete the file due to licensing issues. -+ def schematron_schema_valid(arg): -+ raise NotImplementedError("Validating the ISO schematron requires iso-schematron.rng") - - - def stylesheet_params(**kwargs): -@@ -153,6 +159,13 @@ class Schematron(_etree._Validator): - report document gets stored and can be accessed as the ``validation_report`` - property. - -+ If ``validate_schema`` is set to False, the validation of the schema file -+ itself is disabled. Validation happens by default after building the full -+ schema, unless the schema validation file cannot be found at import time, -+ in which case the validation gets disabled. Some lxml distributions exclude -+ this file due to licensing issues. ISO-Schematron validation can then still -+ be used normally, but the schemas themselves cannot be validated. -+ - Here is a usage example:: - - >>> from lxml import etree -@@ -234,7 +247,8 @@ class Schematron(_etree._Validator): - def __init__(self, etree=None, file=None, include=True, expand=True, - include_params={}, expand_params={}, compile_params={}, - store_schematron=False, store_xslt=False, store_report=False, -- phase=None, error_finder=ASSERTS_ONLY): -+ phase=None, error_finder=ASSERTS_ONLY, -+ validate_schema=schematron_schema_valid_supported): - super(Schematron, self).__init__() - - self._store_report = store_report -@@ -273,7 +287,7 @@ class Schematron(_etree._Validator): - schematron = self._include(schematron, **include_params) - if expand: - schematron = self._expand(schematron, **expand_params) -- if not schematron_schema_valid(schematron): -+ if validate_schema and not schematron_schema_valid(schematron): - raise _etree.SchematronParseError( - "invalid schematron schema: %s" % - schematron_schema_valid.error_log) --- -2.43.0 - diff --git a/Skip-failing-test-test_html_prefix_nsmap.patch b/Skip-failing-test-test_html_prefix_nsmap.patch deleted file mode 100644 index 7d936e3..0000000 --- a/Skip-failing-test-test_html_prefix_nsmap.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 91729cf581f764c3321f644206568f18d0fc92f4 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hrn=C4=8Diar?= -Date: Thu, 18 May 2023 08:00:48 +0200 -Subject: [PATCH] Skip failing test test_html_prefix_nsmap - -Upstream issue: https://bugs.launchpad.net/lxml/+bug/2016939 ---- - src/lxml/tests/test_etree.py | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/src/lxml/tests/test_etree.py b/src/lxml/tests/test_etree.py -index 0339796..1994a7f 100644 ---- a/src/lxml/tests/test_etree.py -+++ b/src/lxml/tests/test_etree.py -@@ -27,6 +27,8 @@ from .common_imports import SillyFileLike, LargeFileLikeUnicode, doctest, make_d - from .common_imports import canonicalize, _str, _bytes - from .common_imports import SimpleFSPath - -+from unittest import skip -+ - print(""" - TESTED VERSION: %s""" % etree.__version__ + """ - Python: %r""" % (sys.version_info,) + """ -@@ -3067,6 +3069,7 @@ class ETreeOnlyTestCase(HelperTestCase): - self.assertEqual(re, e.nsmap) - self.assertEqual(r, s.nsmap) - -+ @skip - def test_html_prefix_nsmap(self): - etree = self.etree - el = etree.HTML('aa').find('.//page-description') --- -2.40.1 - diff --git a/a03a4b3c6b906d33c5ef1a15f3d5ca5fff600c76.patch b/a03a4b3c6b906d33c5ef1a15f3d5ca5fff600c76.patch deleted file mode 100644 index bd02346..0000000 --- a/a03a4b3c6b906d33c5ef1a15f3d5ca5fff600c76.patch +++ /dev/null @@ -1,402 +0,0 @@ -From a03a4b3c6b906d33c5ef1a15f3d5ca5fff600c76 Mon Sep 17 00:00:00 2001 -From: Stefan Behnel -Date: Fri, 23 Dec 2022 10:46:32 +0100 -Subject: [PATCH] Use "noexcept" modifiers for callback functions and fix some - exception value declaration bugs found by Cython 3.0. - ---- - src/lxml/extensions.pxi | 6 +++--- - src/lxml/includes/tree.pxd | 10 +++++----- - src/lxml/includes/xmlerror.pxd | 4 ++-- - src/lxml/includes/xmlparser.pxd | 24 ++++++++++++------------ - src/lxml/parser.pxi | 10 +++++----- - src/lxml/saxparser.pxi | 26 +++++++++++++------------- - src/lxml/serializer.pxi | 4 ++-- - src/lxml/xmlerror.pxi | 14 +++++++------- - src/lxml/xpath.pxi | 2 +- - 9 files changed, 50 insertions(+), 50 deletions(-) - -diff --git a/src/lxml/extensions.pxi b/src/lxml/extensions.pxi -index 35a321b7a..80e53d7b5 100644 ---- a/src/lxml/extensions.pxi -+++ b/src/lxml/extensions.pxi -@@ -393,7 +393,7 @@ cdef tuple LIBXML2_XPATH_ERROR_MESSAGES = ( - b"?? Unknown error ??\n", - ) - --cdef void _forwardXPathError(void* c_ctxt, xmlerror.xmlError* c_error) with gil: -+cdef void _forwardXPathError(void* c_ctxt, xmlerror.xmlError* c_error) noexcept with gil: - cdef xmlerror.xmlError error - cdef int xpath_code - if c_error.message is not NULL: -@@ -414,7 +414,7 @@ cdef void _forwardXPathError(void* c_ctxt, xmlerror.xmlError* c_error) with gil: - - (<_BaseContext>c_ctxt)._error_log._receive(&error) - --cdef void _receiveXPathError(void* c_context, xmlerror.xmlError* error) nogil: -+cdef void _receiveXPathError(void* c_context, xmlerror.xmlError* error) noexcept nogil: - if not __DEBUG: - return - if c_context is NULL: -@@ -851,7 +851,7 @@ cdef void _extension_function_call(_BaseContext context, function, - # lookup the function by name and call it - - cdef void _xpath_function_call(xpath.xmlXPathParserContext* ctxt, -- int nargs) with gil: -+ int nargs) noexcept with gil: - cdef _BaseContext context - cdef xpath.xmlXPathContext* rctxt = ctxt.context - context = <_BaseContext> rctxt.userData -diff --git a/src/lxml/includes/tree.pxd b/src/lxml/includes/tree.pxd -index 03d558a33..312537cbd 100644 ---- a/src/lxml/includes/tree.pxd -+++ b/src/lxml/includes/tree.pxd -@@ -65,7 +65,7 @@ cdef extern from "libxml/chvalid.h" nogil: - - cdef extern from "libxml/hash.h": - ctypedef struct xmlHashTable -- ctypedef void (*xmlHashScanner)(void* payload, void* data, const_xmlChar* name) # may require GIL! -+ ctypedef void (*xmlHashScanner)(void* payload, void* data, const_xmlChar* name) noexcept # may require GIL! - void xmlHashScan(xmlHashTable* table, xmlHashScanner f, void* data) nogil - void* xmlHashLookup(xmlHashTable* table, const_xmlChar* name) nogil - ctypedef void (*xmlHashDeallocator)(void *payload, xmlChar *name) -@@ -411,12 +411,12 @@ cdef extern from "libxml/xmlIO.h": - cdef int xmlOutputBufferClose(xmlOutputBuffer* out) nogil - - ctypedef int (*xmlInputReadCallback)(void* context, -- char* buffer, int len) nogil -- ctypedef int (*xmlInputCloseCallback)(void* context) nogil -+ char* buffer, int len) except -1 nogil -+ ctypedef int (*xmlInputCloseCallback)(void* context) except -1 nogil - - ctypedef int (*xmlOutputWriteCallback)(void* context, -- char* buffer, int len) -- ctypedef int (*xmlOutputCloseCallback)(void* context) -+ char* buffer, int len) except -1 -+ ctypedef int (*xmlOutputCloseCallback)(void* context) except -1 - - cdef xmlOutputBuffer* xmlAllocOutputBuffer( - xmlCharEncodingHandler* encoder) nogil -diff --git a/src/lxml/includes/xmlerror.pxd b/src/lxml/includes/xmlerror.pxd -index c5ac6a0aa..6967378b7 100644 ---- a/src/lxml/includes/xmlerror.pxd -+++ b/src/lxml/includes/xmlerror.pxd -@@ -838,9 +838,9 @@ cdef extern from "libxml/xmlerror.h" nogil: - int int2 - void* node - -- ctypedef void (*xmlGenericErrorFunc)(void* ctxt, char* msg, ...) -+ ctypedef void (*xmlGenericErrorFunc)(void* ctxt, char* msg, ...) noexcept - ctypedef void (*xmlStructuredErrorFunc)(void* userData, -- xmlError* error) -+ xmlError* error) noexcept - - cdef void xmlSetGenericErrorFunc( - void* ctxt, xmlGenericErrorFunc func) -diff --git a/src/lxml/includes/xmlparser.pxd b/src/lxml/includes/xmlparser.pxd -index 9f3056248..c94212cee 100644 ---- a/src/lxml/includes/xmlparser.pxd -+++ b/src/lxml/includes/xmlparser.pxd -@@ -15,37 +15,37 @@ cdef extern from "libxml/parser.h" nogil: - const_xmlChar** namespaces, - int nb_attributes, - int nb_defaulted, -- const_xmlChar** attributes) -+ const_xmlChar** attributes) noexcept - - ctypedef void (*endElementNsSAX2Func)(void* ctx, - const_xmlChar* localname, - const_xmlChar* prefix, -- const_xmlChar* URI) -+ const_xmlChar* URI) noexcept - -- ctypedef void (*startElementSAXFunc)(void* ctx, const_xmlChar* name, const_xmlChar** atts) -+ ctypedef void (*startElementSAXFunc)(void* ctx, const_xmlChar* name, const_xmlChar** atts) noexcept - -- ctypedef void (*endElementSAXFunc)(void* ctx, const_xmlChar* name) -+ ctypedef void (*endElementSAXFunc)(void* ctx, const_xmlChar* name) noexcept - -- ctypedef void (*charactersSAXFunc)(void* ctx, const_xmlChar* ch, int len) -+ ctypedef void (*charactersSAXFunc)(void* ctx, const_xmlChar* ch, int len) noexcept - -- ctypedef void (*cdataBlockSAXFunc)(void* ctx, const_xmlChar* value, int len) -+ ctypedef void (*cdataBlockSAXFunc)(void* ctx, const_xmlChar* value, int len) noexcept - -- ctypedef void (*commentSAXFunc)(void* ctx, const_xmlChar* value) -+ ctypedef void (*commentSAXFunc)(void* ctx, const_xmlChar* value) noexcept - - ctypedef void (*processingInstructionSAXFunc)(void* ctx, - const_xmlChar* target, -- const_xmlChar* data) -+ const_xmlChar* data) noexcept - - ctypedef void (*internalSubsetSAXFunc)(void* ctx, - const_xmlChar* name, - const_xmlChar* externalID, -- const_xmlChar* systemID) -+ const_xmlChar* systemID) noexcept - -- ctypedef void (*endDocumentSAXFunc)(void* ctx) -+ ctypedef void (*endDocumentSAXFunc)(void* ctx) noexcept - -- ctypedef void (*startDocumentSAXFunc)(void* ctx) -+ ctypedef void (*startDocumentSAXFunc)(void* ctx) noexcept - -- ctypedef void (*referenceSAXFunc)(void * ctx, const_xmlChar* name) -+ ctypedef void (*referenceSAXFunc)(void * ctx, const_xmlChar* name) noexcept - - cdef int XML_SAX2_MAGIC - -diff --git a/src/lxml/parser.pxi b/src/lxml/parser.pxi -index f0c8c6b64..e1e9da9f0 100644 ---- a/src/lxml/parser.pxi -+++ b/src/lxml/parser.pxi -@@ -402,10 +402,10 @@ cdef class _FileReaderContext: - finally: - return c_byte_count # swallow any exceptions - --cdef int _readFilelikeParser(void* ctxt, char* c_buffer, int c_size) with gil: -+cdef int _readFilelikeParser(void* ctxt, char* c_buffer, int c_size) except -1 with gil: - return (<_FileReaderContext>ctxt).copyToBuffer(c_buffer, c_size) - --cdef int _readFileParser(void* ctxt, char* c_buffer, int c_size) nogil: -+cdef int _readFileParser(void* ctxt, char* c_buffer, int c_size) except -1 nogil: - return stdio.fread(c_buffer, 1, c_size, ctxt) - - ############################################################ -@@ -626,10 +626,10 @@ cdef _initParserContext(_ParserContext context, - if c_ctxt is not NULL: - context._initParserContext(c_ctxt) - --cdef void _forwardParserError(xmlparser.xmlParserCtxt* _parser_context, xmlerror.xmlError* error) with gil: -+cdef void _forwardParserError(xmlparser.xmlParserCtxt* _parser_context, xmlerror.xmlError* error) noexcept with gil: - (<_ParserContext>_parser_context._private)._error_log._receive(error) - --cdef void _receiveParserError(void* c_context, xmlerror.xmlError* error) nogil: -+cdef void _receiveParserError(void* c_context, xmlerror.xmlError* error) noexcept nogil: - if __DEBUG: - if c_context is NULL or (c_context)._private is NULL: - _forwardError(NULL, error) -@@ -1207,7 +1207,7 @@ cdef class _BaseParser: - context.cleanup() - - --cdef void _initSaxDocument(void* ctxt) with gil: -+cdef void _initSaxDocument(void* ctxt) noexcept with gil: - xmlparser.xmlSAX2StartDocument(ctxt) - c_ctxt = ctxt - c_doc = c_ctxt.myDoc -diff --git a/src/lxml/saxparser.pxi b/src/lxml/saxparser.pxi -index 49e72beaf..1737f0801 100644 ---- a/src/lxml/saxparser.pxi -+++ b/src/lxml/saxparser.pxi -@@ -294,7 +294,7 @@ cdef void _handleSaxStart( - const_xmlChar* c_namespace, int c_nb_namespaces, - const_xmlChar** c_namespaces, - int c_nb_attributes, int c_nb_defaulted, -- const_xmlChar** c_attributes) with gil: -+ const_xmlChar** c_attributes) noexcept with gil: - cdef int i - cdef size_t c_len - c_ctxt = ctxt -@@ -336,7 +336,7 @@ cdef void _handleSaxTargetStart( - const_xmlChar* c_namespace, int c_nb_namespaces, - const_xmlChar** c_namespaces, - int c_nb_attributes, int c_nb_defaulted, -- const_xmlChar** c_attributes) with gil: -+ const_xmlChar** c_attributes) noexcept with gil: - cdef int i - cdef size_t c_len - c_ctxt = ctxt -@@ -407,7 +407,7 @@ cdef void _handleSaxTargetStart( - - - cdef void _handleSaxStartNoNs(void* ctxt, const_xmlChar* c_name, -- const_xmlChar** c_attributes) with gil: -+ const_xmlChar** c_attributes) noexcept with gil: - c_ctxt = ctxt - if c_ctxt._private is NULL or c_ctxt.disableSAX: - return -@@ -426,7 +426,7 @@ cdef void _handleSaxStartNoNs(void* ctxt, const_xmlChar* c_name, - - - cdef void _handleSaxTargetStartNoNs(void* ctxt, const_xmlChar* c_name, -- const_xmlChar** c_attributes) with gil: -+ const_xmlChar** c_attributes) noexcept with gil: - c_ctxt = ctxt - if c_ctxt._private is NULL or c_ctxt.disableSAX: - return -@@ -483,7 +483,7 @@ cdef int _pushSaxStartEvent(_SaxParserContext context, - - cdef void _handleSaxEnd(void* ctxt, const_xmlChar* c_localname, - const_xmlChar* c_prefix, -- const_xmlChar* c_namespace) with gil: -+ const_xmlChar* c_namespace) noexcept with gil: - c_ctxt = ctxt - if c_ctxt._private is NULL or c_ctxt.disableSAX: - return -@@ -506,7 +506,7 @@ cdef void _handleSaxEnd(void* ctxt, const_xmlChar* c_localname, - return # swallow any further exceptions - - --cdef void _handleSaxEndNoNs(void* ctxt, const_xmlChar* c_name) with gil: -+cdef void _handleSaxEndNoNs(void* ctxt, const_xmlChar* c_name) noexcept with gil: - c_ctxt = ctxt - if c_ctxt._private is NULL or c_ctxt.disableSAX: - return -@@ -558,7 +558,7 @@ cdef int _pushSaxEndEvent(_SaxParserContext context, - return 0 - - --cdef void _handleSaxData(void* ctxt, const_xmlChar* c_data, int data_len) with gil: -+cdef void _handleSaxData(void* ctxt, const_xmlChar* c_data, int data_len) noexcept with gil: - # can only be called if parsing with a target - c_ctxt = ctxt - if c_ctxt._private is NULL or c_ctxt.disableSAX: -@@ -575,7 +575,7 @@ cdef void _handleSaxData(void* ctxt, const_xmlChar* c_data, int data_len) with g - - cdef void _handleSaxTargetDoctype(void* ctxt, const_xmlChar* c_name, - const_xmlChar* c_public, -- const_xmlChar* c_system) with gil: -+ const_xmlChar* c_system) noexcept with gil: - # can only be called if parsing with a target - c_ctxt = ctxt - if c_ctxt._private is NULL or c_ctxt.disableSAX: -@@ -592,7 +592,7 @@ cdef void _handleSaxTargetDoctype(void* ctxt, const_xmlChar* c_name, - return # swallow any further exceptions - - --cdef void _handleSaxStartDocument(void* ctxt) with gil: -+cdef void _handleSaxStartDocument(void* ctxt) noexcept with gil: - c_ctxt = ctxt - if c_ctxt._private is NULL or c_ctxt.disableSAX: - return -@@ -608,7 +608,7 @@ cdef void _handleSaxStartDocument(void* ctxt) with gil: - - - cdef void _handleSaxTargetPI(void* ctxt, const_xmlChar* c_target, -- const_xmlChar* c_data) with gil: -+ const_xmlChar* c_data) noexcept with gil: - # can only be called if parsing with a target - c_ctxt = ctxt - if c_ctxt._private is NULL or c_ctxt.disableSAX: -@@ -627,7 +627,7 @@ cdef void _handleSaxTargetPI(void* ctxt, const_xmlChar* c_target, - - - cdef void _handleSaxPIEvent(void* ctxt, const_xmlChar* target, -- const_xmlChar* data) with gil: -+ const_xmlChar* data) noexcept with gil: - # can only be called when collecting pi events - c_ctxt = ctxt - if c_ctxt._private is NULL or c_ctxt.disableSAX: -@@ -645,7 +645,7 @@ cdef void _handleSaxPIEvent(void* ctxt, const_xmlChar* target, - return # swallow any further exceptions - - --cdef void _handleSaxTargetComment(void* ctxt, const_xmlChar* c_data) with gil: -+cdef void _handleSaxTargetComment(void* ctxt, const_xmlChar* c_data) noexcept with gil: - # can only be called if parsing with a target - c_ctxt = ctxt - if c_ctxt._private is NULL or c_ctxt.disableSAX: -@@ -661,7 +661,7 @@ cdef void _handleSaxTargetComment(void* ctxt, const_xmlChar* c_data) with gil: - return # swallow any further exceptions - - --cdef void _handleSaxComment(void* ctxt, const_xmlChar* text) with gil: -+cdef void _handleSaxComment(void* ctxt, const_xmlChar* text) noexcept with gil: - # can only be called when collecting comment events - c_ctxt = ctxt - if c_ctxt._private is NULL or c_ctxt.disableSAX: -diff --git a/src/lxml/serializer.pxi b/src/lxml/serializer.pxi -index 79a02829e..e1c76e1ba 100644 ---- a/src/lxml/serializer.pxi -+++ b/src/lxml/serializer.pxi -@@ -699,10 +699,10 @@ cdef class _FilelikeWriter: - finally: - return retval # and swallow any further exceptions - --cdef int _writeFilelikeWriter(void* ctxt, char* c_buffer, int length): -+cdef int _writeFilelikeWriter(void* ctxt, char* c_buffer, int length) except -1: - return (<_FilelikeWriter>ctxt).write(c_buffer, length) - --cdef int _closeFilelikeWriter(void* ctxt): -+cdef int _closeFilelikeWriter(void* ctxt) except -1: - return (<_FilelikeWriter>ctxt).close() - - cdef _tofilelike(f, _Element element, encoding, doctype, method, -diff --git a/src/lxml/xmlerror.pxi b/src/lxml/xmlerror.pxi -index 1b50444fb..793e1d923 100644 ---- a/src/lxml/xmlerror.pxi -+++ b/src/lxml/xmlerror.pxi -@@ -634,7 +634,7 @@ def use_global_python_log(PyErrorLog log not None): - - - # local log functions: forward error to logger object --cdef void _forwardError(void* c_log_handler, xmlerror.xmlError* error) with gil: -+cdef void _forwardError(void* c_log_handler, xmlerror.xmlError* error) noexcept with gil: - cdef _BaseErrorLog log_handler - if c_log_handler is not NULL: - log_handler = <_BaseErrorLog>c_log_handler -@@ -645,27 +645,27 @@ cdef void _forwardError(void* c_log_handler, xmlerror.xmlError* error) with gil: - log_handler._receive(error) - - --cdef void _receiveError(void* c_log_handler, xmlerror.xmlError* error) nogil: -+cdef void _receiveError(void* c_log_handler, xmlerror.xmlError* error) noexcept nogil: - # no Python objects here, may be called without thread context ! - if __DEBUG: - _forwardError(c_log_handler, error) - - --cdef void _receiveXSLTError(void* c_log_handler, char* msg, ...) nogil: -+cdef void _receiveXSLTError(void* c_log_handler, char* msg, ...) noexcept nogil: - # no Python objects here, may be called without thread context ! - cdef cvarargs.va_list args - cvarargs.va_start(args, msg) - _receiveGenericError(c_log_handler, xmlerror.XML_FROM_XSLT, msg, args) - cvarargs.va_end(args) - --cdef void _receiveRelaxNGParseError(void* c_log_handler, char* msg, ...) nogil: -+cdef void _receiveRelaxNGParseError(void* c_log_handler, char* msg, ...) noexcept nogil: - # no Python objects here, may be called without thread context ! - cdef cvarargs.va_list args - cvarargs.va_start(args, msg) - _receiveGenericError(c_log_handler, xmlerror.XML_FROM_RELAXNGP, msg, args) - cvarargs.va_end(args) - --cdef void _receiveRelaxNGValidationError(void* c_log_handler, char* msg, ...) nogil: -+cdef void _receiveRelaxNGValidationError(void* c_log_handler, char* msg, ...) noexcept nogil: - # no Python objects here, may be called without thread context ! - cdef cvarargs.va_list args - cvarargs.va_start(args, msg) -@@ -673,7 +673,7 @@ cdef void _receiveRelaxNGValidationError(void* c_log_handler, char* msg, ...) no - cvarargs.va_end(args) - - # dummy function: no log output at all --cdef void _nullGenericErrorFunc(void* ctxt, char* msg, ...) nogil: -+cdef void _nullGenericErrorFunc(void* ctxt, char* msg, ...) noexcept nogil: - pass - - -@@ -694,7 +694,7 @@ cdef void _connectGenericErrorLog(log, int c_domain=-1): - - - cdef void _receiveGenericError(void* c_log_handler, int c_domain, -- char* msg, cvarargs.va_list args) nogil: -+ char* msg, cvarargs.va_list args) noexcept nogil: - # no Python objects here, may be called without thread context ! - cdef xmlerror.xmlError c_error - cdef char* c_text -diff --git a/src/lxml/xpath.pxi b/src/lxml/xpath.pxi -index a7cae4bff..704338e89 100644 ---- a/src/lxml/xpath.pxi -+++ b/src/lxml/xpath.pxi -@@ -99,7 +99,7 @@ cdef class _XPathContext(_BaseContext): - - - cdef void _registerExsltFunctionsForNamespaces( -- void* _c_href, void* _ctxt, const_xmlChar* c_prefix): -+ void* _c_href, void* _ctxt, const_xmlChar* c_prefix) noexcept: - c_href = _c_href - ctxt = _ctxt - diff --git a/dcbc0cc1cb0cedf8019184aaca805d2a649cd8de.patch b/dcbc0cc1cb0cedf8019184aaca805d2a649cd8de.patch deleted file mode 100644 index 8de9737..0000000 --- a/dcbc0cc1cb0cedf8019184aaca805d2a649cd8de.patch +++ /dev/null @@ -1,1088 +0,0 @@ -From dcbc0cc1cb0cedf8019184aaca805d2a649cd8de Mon Sep 17 00:00:00 2001 -From: Stefan Behnel -Date: Thu, 15 Dec 2022 11:38:42 +0100 -Subject: [PATCH] Use generic 'nogil' block markers in pxd declarations where - possible, except for a few callback declarations that may be used for regular - GIL functions. - ---- - src/lxml/includes/c14n.pxd | 9 +- - src/lxml/includes/htmlparser.pxd | 26 ++-- - src/lxml/includes/relaxng.pxd | 22 +-- - src/lxml/includes/schematron.pxd | 16 +- - src/lxml/includes/tree.pxd | 260 +++++++++++++++---------------- - src/lxml/includes/uri.pxd | 2 +- - src/lxml/includes/xinclude.pxd | 20 +-- - src/lxml/includes/xmlerror.pxd | 12 +- - src/lxml/includes/xmlparser.pxd | 67 ++++---- - src/lxml/includes/xmlschema.pxd | 2 +- - src/lxml/includes/xpath.pxd | 73 ++++----- - src/lxml/includes/xslt.pxd | 85 +++++----- - 12 files changed, 297 insertions(+), 297 deletions(-) - -diff --git a/src/lxml/includes/c14n.pxd b/src/lxml/includes/c14n.pxd -index d075e90e2..8b1f3c4c5 100644 ---- a/src/lxml/includes/c14n.pxd -+++ b/src/lxml/includes/c14n.pxd -@@ -1,13 +1,13 @@ - from lxml.includes.tree cimport xmlDoc, xmlOutputBuffer, xmlChar - from lxml.includes.xpath cimport xmlNodeSet - --cdef extern from "libxml/c14n.h": -+cdef extern from "libxml/c14n.h" nogil: - cdef int xmlC14NDocDumpMemory(xmlDoc* doc, - xmlNodeSet* nodes, - int exclusive, - xmlChar** inclusive_ns_prefixes, - int with_comments, -- xmlChar** doc_txt_ptr) nogil -+ xmlChar** doc_txt_ptr) - - cdef int xmlC14NDocSave(xmlDoc* doc, - xmlNodeSet* nodes, -@@ -15,12 +15,11 @@ cdef extern from "libxml/c14n.h": - xmlChar** inclusive_ns_prefixes, - int with_comments, - char* filename, -- int compression) nogil -+ int compression) - - cdef int xmlC14NDocSaveTo(xmlDoc* doc, - xmlNodeSet* nodes, - int exclusive, - xmlChar** inclusive_ns_prefixes, - int with_comments, -- xmlOutputBuffer* buffer) nogil -- -+ xmlOutputBuffer* buffer) -diff --git a/src/lxml/includes/htmlparser.pxd b/src/lxml/includes/htmlparser.pxd -index 145a69a06..31dcc406c 100644 ---- a/src/lxml/includes/htmlparser.pxd -+++ b/src/lxml/includes/htmlparser.pxd -@@ -4,7 +4,7 @@ from lxml.includes.tree cimport xmlDoc - from lxml.includes.tree cimport xmlInputReadCallback, xmlInputCloseCallback - from lxml.includes.xmlparser cimport xmlParserCtxt, xmlSAXHandler, xmlSAXHandlerV1 - --cdef extern from "libxml/HTMLparser.h": -+cdef extern from "libxml/HTMLparser.h" nogil: - ctypedef enum htmlParserOption: - HTML_PARSE_NOERROR # suppress error reports - HTML_PARSE_NOWARNING # suppress warning reports -@@ -24,33 +24,33 @@ cdef extern from "libxml/HTMLparser.h": - xmlSAXHandlerV1 htmlDefaultSAXHandler - - cdef xmlParserCtxt* htmlCreateMemoryParserCtxt( -- char* buffer, int size) nogil -+ char* buffer, int size) - cdef xmlParserCtxt* htmlCreateFileParserCtxt( -- char* filename, char* encoding) nogil -+ char* filename, char* encoding) - cdef xmlParserCtxt* htmlCreatePushParserCtxt(xmlSAXHandler* sax, - void* user_data, - char* chunk, int size, -- char* filename, int enc) nogil -- cdef void htmlFreeParserCtxt(xmlParserCtxt* ctxt) nogil -- cdef void htmlCtxtReset(xmlParserCtxt* ctxt) nogil -- cdef int htmlCtxtUseOptions(xmlParserCtxt* ctxt, int options) nogil -- cdef int htmlParseDocument(xmlParserCtxt* ctxt) nogil -+ char* filename, int enc) -+ cdef void htmlFreeParserCtxt(xmlParserCtxt* ctxt) -+ cdef void htmlCtxtReset(xmlParserCtxt* ctxt) -+ cdef int htmlCtxtUseOptions(xmlParserCtxt* ctxt, int options) -+ cdef int htmlParseDocument(xmlParserCtxt* ctxt) - cdef int htmlParseChunk(xmlParserCtxt* ctxt, -- char* chunk, int size, int terminate) nogil -+ char* chunk, int size, int terminate) - - cdef xmlDoc* htmlCtxtReadFile(xmlParserCtxt* ctxt, - char* filename, const_char* encoding, -- int options) nogil -+ int options) - cdef xmlDoc* htmlCtxtReadDoc(xmlParserCtxt* ctxt, - char* buffer, char* URL, const_char* encoding, -- int options) nogil -+ int options) - cdef xmlDoc* htmlCtxtReadIO(xmlParserCtxt* ctxt, - xmlInputReadCallback ioread, - xmlInputCloseCallback ioclose, - void* ioctx, - char* URL, const_char* encoding, -- int options) nogil -+ int options) - cdef xmlDoc* htmlCtxtReadMemory(xmlParserCtxt* ctxt, - char* buffer, int size, - char* filename, const_char* encoding, -- int options) nogil -+ int options) -diff --git a/src/lxml/includes/relaxng.pxd b/src/lxml/includes/relaxng.pxd -index 28e9212d2..5ac96711e 100644 ---- a/src/lxml/includes/relaxng.pxd -+++ b/src/lxml/includes/relaxng.pxd -@@ -1,7 +1,7 @@ - from lxml.includes.tree cimport xmlDoc - from lxml.includes.xmlerror cimport xmlStructuredErrorFunc - --cdef extern from "libxml/relaxng.h": -+cdef extern from "libxml/relaxng.h" nogil: - ctypedef struct xmlRelaxNG - ctypedef struct xmlRelaxNGParserCtxt - -@@ -49,16 +49,16 @@ cdef extern from "libxml/relaxng.h": - XML_RELAXNG_ERR_ELEMWRONG = 38 - XML_RELAXNG_ERR_TEXTWRONG = 39 - -- cdef xmlRelaxNGValidCtxt* xmlRelaxNGNewValidCtxt(xmlRelaxNG* schema) nogil -- cdef int xmlRelaxNGValidateDoc(xmlRelaxNGValidCtxt* ctxt, xmlDoc* doc) nogil -- cdef xmlRelaxNG* xmlRelaxNGParse(xmlRelaxNGParserCtxt* ctxt) nogil -- cdef xmlRelaxNGParserCtxt* xmlRelaxNGNewParserCtxt(char* URL) nogil -- cdef xmlRelaxNGParserCtxt* xmlRelaxNGNewDocParserCtxt(xmlDoc* doc) nogil -- cdef void xmlRelaxNGFree(xmlRelaxNG* schema) nogil -- cdef void xmlRelaxNGFreeParserCtxt(xmlRelaxNGParserCtxt* ctxt) nogil -- cdef void xmlRelaxNGFreeValidCtxt(xmlRelaxNGValidCtxt* ctxt) nogil -+ cdef xmlRelaxNGValidCtxt* xmlRelaxNGNewValidCtxt(xmlRelaxNG* schema) -+ cdef int xmlRelaxNGValidateDoc(xmlRelaxNGValidCtxt* ctxt, xmlDoc* doc) -+ cdef xmlRelaxNG* xmlRelaxNGParse(xmlRelaxNGParserCtxt* ctxt) -+ cdef xmlRelaxNGParserCtxt* xmlRelaxNGNewParserCtxt(char* URL) -+ cdef xmlRelaxNGParserCtxt* xmlRelaxNGNewDocParserCtxt(xmlDoc* doc) -+ cdef void xmlRelaxNGFree(xmlRelaxNG* schema) -+ cdef void xmlRelaxNGFreeParserCtxt(xmlRelaxNGParserCtxt* ctxt) -+ cdef void xmlRelaxNGFreeValidCtxt(xmlRelaxNGValidCtxt* ctxt) - - cdef void xmlRelaxNGSetValidStructuredErrors( -- xmlRelaxNGValidCtxt* ctxt, xmlStructuredErrorFunc serror, void *ctx) nogil -+ xmlRelaxNGValidCtxt* ctxt, xmlStructuredErrorFunc serror, void *ctx) - cdef void xmlRelaxNGSetParserStructuredErrors( -- xmlRelaxNGParserCtxt* ctxt, xmlStructuredErrorFunc serror, void *ctx) nogil -+ xmlRelaxNGParserCtxt* ctxt, xmlStructuredErrorFunc serror, void *ctx) -diff --git a/src/lxml/includes/schematron.pxd b/src/lxml/includes/schematron.pxd -index f8e325284..181248afd 100644 ---- a/src/lxml/includes/schematron.pxd -+++ b/src/lxml/includes/schematron.pxd -@@ -1,7 +1,7 @@ - from lxml.includes cimport xmlerror - from lxml.includes.tree cimport xmlDoc - --cdef extern from "libxml/schematron.h": -+cdef extern from "libxml/schematron.h" nogil: - ctypedef struct xmlSchematron - ctypedef struct xmlSchematronParserCtxt - ctypedef struct xmlSchematronValidCtxt -@@ -16,19 +16,19 @@ cdef extern from "libxml/schematron.h": - XML_SCHEMATRON_OUT_IO = 1024 # output to I/O mechanism - - cdef xmlSchematronParserCtxt* xmlSchematronNewDocParserCtxt( -- xmlDoc* doc) nogil -+ xmlDoc* doc) - cdef xmlSchematronParserCtxt* xmlSchematronNewParserCtxt( - char* filename) nogil - cdef xmlSchematronValidCtxt* xmlSchematronNewValidCtxt( -- xmlSchematron* schema, int options) nogil -+ xmlSchematron* schema, int options) - -- cdef xmlSchematron* xmlSchematronParse(xmlSchematronParserCtxt* ctxt) nogil -+ cdef xmlSchematron* xmlSchematronParse(xmlSchematronParserCtxt* ctxt) - cdef int xmlSchematronValidateDoc(xmlSchematronValidCtxt* ctxt, -- xmlDoc* instance) nogil -+ xmlDoc* instance) - -- cdef void xmlSchematronFreeParserCtxt(xmlSchematronParserCtxt* ctxt) nogil -- cdef void xmlSchematronFreeValidCtxt(xmlSchematronValidCtxt* ctxt) nogil -- cdef void xmlSchematronFree(xmlSchematron* schema) nogil -+ cdef void xmlSchematronFreeParserCtxt(xmlSchematronParserCtxt* ctxt) -+ cdef void xmlSchematronFreeValidCtxt(xmlSchematronValidCtxt* ctxt) -+ cdef void xmlSchematronFree(xmlSchematron* schema) - cdef void xmlSchematronSetValidStructuredErrors( - xmlSchematronValidCtxt* ctxt, - xmlerror.xmlStructuredErrorFunc error_func, void *data) -diff --git a/src/lxml/includes/tree.pxd b/src/lxml/includes/tree.pxd -index 010af8090..03d558a33 100644 ---- a/src/lxml/includes/tree.pxd -+++ b/src/lxml/includes/tree.pxd -@@ -9,19 +9,19 @@ cdef extern from "libxml/xmlversion.h": - cdef const_char* xmlParserVersion - cdef int LIBXML_VERSION - --cdef extern from "libxml/xmlstring.h": -+cdef extern from "libxml/xmlstring.h" nogil: - ctypedef unsigned char xmlChar - ctypedef const xmlChar const_xmlChar "const xmlChar" -- cdef int xmlStrlen(const_xmlChar* str) nogil -- cdef xmlChar* xmlStrdup(const_xmlChar* cur) nogil -- cdef int xmlStrncmp(const_xmlChar* str1, const_xmlChar* str2, int length) nogil -- cdef int xmlStrcmp(const_xmlChar* str1, const_xmlChar* str2) nogil -- cdef int xmlStrcasecmp(const xmlChar *str1, const xmlChar *str2) nogil -- cdef const_xmlChar* xmlStrstr(const_xmlChar* str1, const_xmlChar* str2) nogil -- cdef const_xmlChar* xmlStrchr(const_xmlChar* str1, xmlChar ch) nogil -+ cdef int xmlStrlen(const_xmlChar* str) -+ cdef xmlChar* xmlStrdup(const_xmlChar* cur) -+ cdef int xmlStrncmp(const_xmlChar* str1, const_xmlChar* str2, int length) -+ cdef int xmlStrcmp(const_xmlChar* str1, const_xmlChar* str2) -+ cdef int xmlStrcasecmp(const xmlChar *str1, const xmlChar *str2) -+ cdef const_xmlChar* xmlStrstr(const_xmlChar* str1, const_xmlChar* str2) -+ cdef const_xmlChar* xmlStrchr(const_xmlChar* str1, xmlChar ch) - cdef const_xmlChar* _xcstr "(const xmlChar*)PyBytes_AS_STRING" (object s) - --cdef extern from "libxml/encoding.h": -+cdef extern from "libxml/encoding.h" nogil: - ctypedef enum xmlCharEncoding: - XML_CHAR_ENCODING_ERROR = -1 # No char encoding detected - XML_CHAR_ENCODING_NONE = 0 # No char encoding detected -@@ -49,19 +49,19 @@ cdef extern from "libxml/encoding.h": - XML_CHAR_ENCODING_ASCII = 22 # pure ASCII - - ctypedef struct xmlCharEncodingHandler -- cdef xmlCharEncodingHandler* xmlFindCharEncodingHandler(char* name) nogil -+ cdef xmlCharEncodingHandler* xmlFindCharEncodingHandler(char* name) - cdef xmlCharEncodingHandler* xmlGetCharEncodingHandler( -- xmlCharEncoding enc) nogil -- cdef int xmlCharEncCloseFunc(xmlCharEncodingHandler* handler) nogil -- cdef xmlCharEncoding xmlDetectCharEncoding(const_xmlChar* text, int len) nogil -- cdef const_char* xmlGetCharEncodingName(xmlCharEncoding enc) nogil -- cdef xmlCharEncoding xmlParseCharEncoding(char* name) nogil -+ xmlCharEncoding enc) -+ cdef int xmlCharEncCloseFunc(xmlCharEncodingHandler* handler) -+ cdef xmlCharEncoding xmlDetectCharEncoding(const_xmlChar* text, int len) -+ cdef const_char* xmlGetCharEncodingName(xmlCharEncoding enc) -+ cdef xmlCharEncoding xmlParseCharEncoding(char* name) - ctypedef int (*xmlCharEncodingOutputFunc)( - unsigned char *out_buf, int *outlen, const_uchar *in_buf, int *inlen) - --cdef extern from "libxml/chvalid.h": -- cdef int xmlIsChar_ch(char c) nogil -- cdef int xmlIsCharQ(int ch) nogil -+cdef extern from "libxml/chvalid.h" nogil: -+ cdef int xmlIsChar_ch(char c) -+ cdef int xmlIsCharQ(int ch) - - cdef extern from "libxml/hash.h": - ctypedef struct xmlHashTable -@@ -69,20 +69,20 @@ cdef extern from "libxml/hash.h": - void xmlHashScan(xmlHashTable* table, xmlHashScanner f, void* data) nogil - void* xmlHashLookup(xmlHashTable* table, const_xmlChar* name) nogil - ctypedef void (*xmlHashDeallocator)(void *payload, xmlChar *name) -- cdef xmlHashTable* xmlHashCreate(int size) -- cdef xmlHashTable* xmlHashCreateDict(int size, xmlDict *dict) -- cdef int xmlHashSize(xmlHashTable* table) -- cdef void xmlHashFree(xmlHashTable* table, xmlHashDeallocator f) -+ cdef xmlHashTable* xmlHashCreate(int size) nogil -+ cdef xmlHashTable* xmlHashCreateDict(int size, xmlDict *dict) nogil -+ cdef int xmlHashSize(xmlHashTable* table) nogil -+ cdef void xmlHashFree(xmlHashTable* table, xmlHashDeallocator f) nogil - --cdef extern from *: # actually "libxml/dict.h" -+cdef extern from * nogil: # actually "libxml/dict.h" - # libxml/dict.h appears to be broken to include in C - ctypedef struct xmlDict -- cdef const_xmlChar* xmlDictLookup(xmlDict* dict, const_xmlChar* name, int len) nogil -- cdef const_xmlChar* xmlDictExists(xmlDict* dict, const_xmlChar* name, int len) nogil -- cdef int xmlDictOwns(xmlDict* dict, const_xmlChar* name) nogil -- cdef size_t xmlDictSize(xmlDict* dict) nogil -+ cdef const_xmlChar* xmlDictLookup(xmlDict* dict, const_xmlChar* name, int len) -+ cdef const_xmlChar* xmlDictExists(xmlDict* dict, const_xmlChar* name, int len) -+ cdef int xmlDictOwns(xmlDict* dict, const_xmlChar* name) -+ cdef size_t xmlDictSize(xmlDict* dict) - --cdef extern from "libxml/tree.h": -+cdef extern from "libxml/tree.h" nogil: - ctypedef struct xmlDoc - ctypedef struct xmlAttr - ctypedef struct xmlNotationTable -@@ -305,100 +305,100 @@ cdef extern from "libxml/tree.h": - - const_xmlChar* XML_XML_NAMESPACE - -- cdef void xmlFreeDoc(xmlDoc* cur) nogil -- cdef void xmlFreeDtd(xmlDtd* cur) nogil -- cdef void xmlFreeNode(xmlNode* cur) nogil -- cdef void xmlFreeNsList(xmlNs* ns) nogil -- cdef void xmlFreeNs(xmlNs* ns) nogil -- cdef void xmlFree(void* buf) nogil -+ cdef void xmlFreeDoc(xmlDoc* cur) -+ cdef void xmlFreeDtd(xmlDtd* cur) -+ cdef void xmlFreeNode(xmlNode* cur) -+ cdef void xmlFreeNsList(xmlNs* ns) -+ cdef void xmlFreeNs(xmlNs* ns) -+ cdef void xmlFree(void* buf) - -- cdef xmlNode* xmlNewNode(xmlNs* ns, const_xmlChar* name) nogil -- cdef xmlNode* xmlNewDocText(xmlDoc* doc, const_xmlChar* content) nogil -- cdef xmlNode* xmlNewDocComment(xmlDoc* doc, const_xmlChar* content) nogil -- cdef xmlNode* xmlNewDocPI(xmlDoc* doc, const_xmlChar* name, const_xmlChar* content) nogil -- cdef xmlNode* xmlNewReference(xmlDoc* doc, const_xmlChar* name) nogil -- cdef xmlNode* xmlNewCDataBlock(xmlDoc* doc, const_xmlChar* text, int len) nogil -- cdef xmlNs* xmlNewNs(xmlNode* node, const_xmlChar* href, const_xmlChar* prefix) nogil -- cdef xmlNode* xmlAddChild(xmlNode* parent, xmlNode* cur) nogil -- cdef xmlNode* xmlReplaceNode(xmlNode* old, xmlNode* cur) nogil -- cdef xmlNode* xmlAddPrevSibling(xmlNode* cur, xmlNode* elem) nogil -- cdef xmlNode* xmlAddNextSibling(xmlNode* cur, xmlNode* elem) nogil -+ cdef xmlNode* xmlNewNode(xmlNs* ns, const_xmlChar* name) -+ cdef xmlNode* xmlNewDocText(xmlDoc* doc, const_xmlChar* content) -+ cdef xmlNode* xmlNewDocComment(xmlDoc* doc, const_xmlChar* content) -+ cdef xmlNode* xmlNewDocPI(xmlDoc* doc, const_xmlChar* name, const_xmlChar* content) -+ cdef xmlNode* xmlNewReference(xmlDoc* doc, const_xmlChar* name) -+ cdef xmlNode* xmlNewCDataBlock(xmlDoc* doc, const_xmlChar* text, int len) -+ cdef xmlNs* xmlNewNs(xmlNode* node, const_xmlChar* href, const_xmlChar* prefix) -+ cdef xmlNode* xmlAddChild(xmlNode* parent, xmlNode* cur) -+ cdef xmlNode* xmlReplaceNode(xmlNode* old, xmlNode* cur) -+ cdef xmlNode* xmlAddPrevSibling(xmlNode* cur, xmlNode* elem) -+ cdef xmlNode* xmlAddNextSibling(xmlNode* cur, xmlNode* elem) - cdef xmlNode* xmlNewDocNode(xmlDoc* doc, xmlNs* ns, -- const_xmlChar* name, const_xmlChar* content) nogil -- cdef xmlDoc* xmlNewDoc(const_xmlChar* version) nogil -- cdef xmlAttr* xmlNewProp(xmlNode* node, const_xmlChar* name, const_xmlChar* value) nogil -+ const_xmlChar* name, const_xmlChar* content) -+ cdef xmlDoc* xmlNewDoc(const_xmlChar* version) -+ cdef xmlAttr* xmlNewProp(xmlNode* node, const_xmlChar* name, const_xmlChar* value) - cdef xmlAttr* xmlNewNsProp(xmlNode* node, xmlNs* ns, -- const_xmlChar* name, const_xmlChar* value) nogil -- cdef xmlChar* xmlGetNoNsProp(xmlNode* node, const_xmlChar* name) nogil -- cdef xmlChar* xmlGetNsProp(xmlNode* node, const_xmlChar* name, const_xmlChar* nameSpace) nogil -- cdef void xmlSetNs(xmlNode* node, xmlNs* ns) nogil -- cdef xmlAttr* xmlSetProp(xmlNode* node, const_xmlChar* name, const_xmlChar* value) nogil -+ const_xmlChar* name, const_xmlChar* value) -+ cdef xmlChar* xmlGetNoNsProp(xmlNode* node, const_xmlChar* name) -+ cdef xmlChar* xmlGetNsProp(xmlNode* node, const_xmlChar* name, const_xmlChar* nameSpace) -+ cdef void xmlSetNs(xmlNode* node, xmlNs* ns) -+ cdef xmlAttr* xmlSetProp(xmlNode* node, const_xmlChar* name, const_xmlChar* value) - cdef xmlAttr* xmlSetNsProp(xmlNode* node, xmlNs* ns, -- const_xmlChar* name, const_xmlChar* value) nogil -- cdef int xmlRemoveID(xmlDoc* doc, xmlAttr* cur) nogil -- cdef int xmlRemoveProp(xmlAttr* cur) nogil -- cdef void xmlFreePropList(xmlAttr* cur) nogil -- cdef xmlChar* xmlGetNodePath(xmlNode* node) nogil -- cdef void xmlDocDumpMemory(xmlDoc* cur, char** mem, int* size) nogil -+ const_xmlChar* name, const_xmlChar* value) -+ cdef int xmlRemoveID(xmlDoc* doc, xmlAttr* cur) -+ cdef int xmlRemoveProp(xmlAttr* cur) -+ cdef void xmlFreePropList(xmlAttr* cur) -+ cdef xmlChar* xmlGetNodePath(xmlNode* node) -+ cdef void xmlDocDumpMemory(xmlDoc* cur, char** mem, int* size) - cdef void xmlDocDumpMemoryEnc(xmlDoc* cur, char** mem, int* size, -- char* encoding) nogil -+ char* encoding) - cdef int xmlSaveFileTo(xmlOutputBuffer* out, xmlDoc* cur, -- char* encoding) nogil -- -- cdef void xmlUnlinkNode(xmlNode* cur) nogil -- cdef xmlNode* xmlDocSetRootElement(xmlDoc* doc, xmlNode* root) nogil -- cdef xmlNode* xmlDocGetRootElement(xmlDoc* doc) nogil -- cdef void xmlSetTreeDoc(xmlNode* tree, xmlDoc* doc) nogil -- cdef xmlAttr* xmlHasProp(xmlNode* node, const_xmlChar* name) nogil -- cdef xmlAttr* xmlHasNsProp(xmlNode* node, const_xmlChar* name, const_xmlChar* nameSpace) nogil -- cdef xmlChar* xmlNodeGetContent(xmlNode* cur) nogil -- cdef int xmlNodeBufGetContent(xmlBuffer* buffer, xmlNode* cur) nogil -- cdef xmlNs* xmlSearchNs(xmlDoc* doc, xmlNode* node, const_xmlChar* prefix) nogil -- cdef xmlNs* xmlSearchNsByHref(xmlDoc* doc, xmlNode* node, const_xmlChar* href) nogil -- cdef int xmlIsBlankNode(xmlNode* node) nogil -- cdef long xmlGetLineNo(xmlNode* node) nogil -- cdef void xmlElemDump(stdio.FILE* f, xmlDoc* doc, xmlNode* cur) nogil -+ char* encoding) -+ -+ cdef void xmlUnlinkNode(xmlNode* cur) -+ cdef xmlNode* xmlDocSetRootElement(xmlDoc* doc, xmlNode* root) -+ cdef xmlNode* xmlDocGetRootElement(xmlDoc* doc) -+ cdef void xmlSetTreeDoc(xmlNode* tree, xmlDoc* doc) -+ cdef xmlAttr* xmlHasProp(xmlNode* node, const_xmlChar* name) -+ cdef xmlAttr* xmlHasNsProp(xmlNode* node, const_xmlChar* name, const_xmlChar* nameSpace) -+ cdef xmlChar* xmlNodeGetContent(xmlNode* cur) -+ cdef int xmlNodeBufGetContent(xmlBuffer* buffer, xmlNode* cur) -+ cdef xmlNs* xmlSearchNs(xmlDoc* doc, xmlNode* node, const_xmlChar* prefix) -+ cdef xmlNs* xmlSearchNsByHref(xmlDoc* doc, xmlNode* node, const_xmlChar* href) -+ cdef int xmlIsBlankNode(xmlNode* node) -+ cdef long xmlGetLineNo(xmlNode* node) -+ cdef void xmlElemDump(stdio.FILE* f, xmlDoc* doc, xmlNode* cur) - cdef void xmlNodeDumpOutput(xmlOutputBuffer* buf, - xmlDoc* doc, xmlNode* cur, int level, -- int format, const_char* encoding) nogil -+ int format, const_char* encoding) - cdef void xmlBufAttrSerializeTxtContent(xmlOutputBuffer *buf, xmlDoc *doc, -- xmlAttr *attr, const_xmlChar *string) nogil -- cdef void xmlNodeSetName(xmlNode* cur, const_xmlChar* name) nogil -- cdef void xmlNodeSetContent(xmlNode* cur, const_xmlChar* content) nogil -- cdef xmlDtd* xmlCopyDtd(xmlDtd* dtd) nogil -- cdef xmlDoc* xmlCopyDoc(xmlDoc* doc, int recursive) nogil -- cdef xmlNode* xmlCopyNode(xmlNode* node, int extended) nogil -- cdef xmlNode* xmlDocCopyNode(xmlNode* node, xmlDoc* doc, int extended) nogil -- cdef int xmlReconciliateNs(xmlDoc* doc, xmlNode* tree) nogil -- cdef xmlNs* xmlNewReconciliedNs(xmlDoc* doc, xmlNode* tree, xmlNs* ns) nogil -- cdef xmlBuffer* xmlBufferCreate() nogil -- cdef void xmlBufferWriteChar(xmlBuffer* buf, char* string) nogil -- cdef void xmlBufferFree(xmlBuffer* buf) nogil -- cdef const_xmlChar* xmlBufferContent(xmlBuffer* buf) nogil -- cdef int xmlBufferLength(xmlBuffer* buf) nogil -- cdef const_xmlChar* xmlBufContent(xmlBuf* buf) nogil # new in libxml2 2.9 -- cdef size_t xmlBufUse(xmlBuf* buf) nogil # new in libxml2 2.9 -- cdef int xmlKeepBlanksDefault(int val) nogil -- cdef xmlChar* xmlNodeGetBase(xmlDoc* doc, xmlNode* node) nogil -+ xmlAttr *attr, const_xmlChar *string) -+ cdef void xmlNodeSetName(xmlNode* cur, const_xmlChar* name) -+ cdef void xmlNodeSetContent(xmlNode* cur, const_xmlChar* content) -+ cdef xmlDtd* xmlCopyDtd(xmlDtd* dtd) -+ cdef xmlDoc* xmlCopyDoc(xmlDoc* doc, int recursive) -+ cdef xmlNode* xmlCopyNode(xmlNode* node, int extended) -+ cdef xmlNode* xmlDocCopyNode(xmlNode* node, xmlDoc* doc, int extended) -+ cdef int xmlReconciliateNs(xmlDoc* doc, xmlNode* tree) -+ cdef xmlNs* xmlNewReconciliedNs(xmlDoc* doc, xmlNode* tree, xmlNs* ns) -+ cdef xmlBuffer* xmlBufferCreate() -+ cdef void xmlBufferWriteChar(xmlBuffer* buf, char* string) -+ cdef void xmlBufferFree(xmlBuffer* buf) -+ cdef const_xmlChar* xmlBufferContent(xmlBuffer* buf) -+ cdef int xmlBufferLength(xmlBuffer* buf) -+ cdef const_xmlChar* xmlBufContent(xmlBuf* buf) # new in libxml2 2.9 -+ cdef size_t xmlBufUse(xmlBuf* buf) # new in libxml2 2.9 -+ cdef int xmlKeepBlanksDefault(int val) -+ cdef xmlChar* xmlNodeGetBase(xmlDoc* doc, xmlNode* node) - cdef xmlDtd* xmlCreateIntSubset(xmlDoc* doc, const_xmlChar* name, -- const_xmlChar* ExternalID, const_xmlChar* SystemID) nogil -- cdef void xmlNodeSetBase(xmlNode* node, const_xmlChar* uri) nogil -- cdef int xmlValidateNCName(const_xmlChar* value, int space) nogil -+ const_xmlChar* ExternalID, const_xmlChar* SystemID) -+ cdef void xmlNodeSetBase(xmlNode* node, const_xmlChar* uri) -+ cdef int xmlValidateNCName(const_xmlChar* value, int space) - --cdef extern from "libxml/uri.h": -- cdef const_xmlChar* xmlBuildURI(const_xmlChar* href, const_xmlChar* base) nogil -+cdef extern from "libxml/uri.h" nogil: -+ cdef const_xmlChar* xmlBuildURI(const_xmlChar* href, const_xmlChar* base) - --cdef extern from "libxml/HTMLtree.h": -+cdef extern from "libxml/HTMLtree.h" nogil: - cdef void htmlNodeDumpFormatOutput(xmlOutputBuffer* buf, - xmlDoc* doc, xmlNode* cur, -- char* encoding, int format) nogil -- cdef xmlDoc* htmlNewDoc(const_xmlChar* uri, const_xmlChar* externalID) nogil -+ char* encoding, int format) -+ cdef xmlDoc* htmlNewDoc(const_xmlChar* uri, const_xmlChar* externalID) - --cdef extern from "libxml/valid.h": -- cdef xmlAttr* xmlGetID(xmlDoc* doc, const_xmlChar* ID) nogil -+cdef extern from "libxml/valid.h" nogil: -+ cdef xmlAttr* xmlGetID(xmlDoc* doc, const_xmlChar* ID) - cdef void xmlDumpNotationTable(xmlBuffer* buffer, -- xmlNotationTable* table) nogil -- cdef int xmlValidateNameValue(const_xmlChar* value) nogil -+ xmlNotationTable* table) -+ cdef int xmlValidateNameValue(const_xmlChar* value) - - cdef extern from "libxml/xmlIO.h": - cdef int xmlOutputBufferWrite(xmlOutputBuffer* out, -@@ -411,8 +411,8 @@ cdef extern from "libxml/xmlIO.h": - cdef int xmlOutputBufferClose(xmlOutputBuffer* out) nogil - - ctypedef int (*xmlInputReadCallback)(void* context, -- char* buffer, int len) -- ctypedef int (*xmlInputCloseCallback)(void* context) -+ char* buffer, int len) nogil -+ ctypedef int (*xmlInputCloseCallback)(void* context) nogil - - ctypedef int (*xmlOutputWriteCallback)(void* context, - char* buffer, int len) -@@ -430,7 +430,7 @@ cdef extern from "libxml/xmlIO.h": - cdef xmlOutputBuffer* xmlOutputBufferCreateFilename( - char* URI, xmlCharEncodingHandler* encoder, int compression) nogil - --cdef extern from "libxml/xmlsave.h": -+cdef extern from "libxml/xmlsave.h" nogil: - ctypedef struct xmlSaveCtxt - - ctypedef enum xmlSaveOption: -@@ -443,20 +443,20 @@ cdef extern from "libxml/xmlsave.h": - XML_SAVE_AS_HTML = 64 # force HTML serialization on XML doc (2.7.2) - - cdef xmlSaveCtxt* xmlSaveToFilename(char* filename, char* encoding, -- int options) nogil -+ int options) - cdef xmlSaveCtxt* xmlSaveToBuffer(xmlBuffer* buffer, char* encoding, -- int options) nogil # libxml2 2.6.23 -- cdef long xmlSaveDoc(xmlSaveCtxt* ctxt, xmlDoc* doc) nogil -- cdef long xmlSaveTree(xmlSaveCtxt* ctxt, xmlNode* node) nogil -- cdef int xmlSaveClose(xmlSaveCtxt* ctxt) nogil -- cdef int xmlSaveFlush(xmlSaveCtxt* ctxt) nogil -- cdef int xmlSaveSetAttrEscape(xmlSaveCtxt* ctxt, void* escape_func) nogil -- cdef int xmlSaveSetEscape(xmlSaveCtxt* ctxt, void* escape_func) nogil -- --cdef extern from "libxml/globals.h": -- cdef int xmlThrDefKeepBlanksDefaultValue(int onoff) nogil -- cdef int xmlThrDefLineNumbersDefaultValue(int onoff) nogil -- cdef int xmlThrDefIndentTreeOutput(int onoff) nogil -+ int options) # libxml2 2.6.23 -+ cdef long xmlSaveDoc(xmlSaveCtxt* ctxt, xmlDoc* doc) -+ cdef long xmlSaveTree(xmlSaveCtxt* ctxt, xmlNode* node) -+ cdef int xmlSaveClose(xmlSaveCtxt* ctxt) -+ cdef int xmlSaveFlush(xmlSaveCtxt* ctxt) -+ cdef int xmlSaveSetAttrEscape(xmlSaveCtxt* ctxt, void* escape_func) -+ cdef int xmlSaveSetEscape(xmlSaveCtxt* ctxt, void* escape_func) -+ -+cdef extern from "libxml/globals.h" nogil: -+ cdef int xmlThrDefKeepBlanksDefaultValue(int onoff) -+ cdef int xmlThrDefLineNumbersDefaultValue(int onoff) -+ cdef int xmlThrDefIndentTreeOutput(int onoff) - - cdef extern from "libxml/xmlmemory.h" nogil: - cdef void* xmlMalloc(size_t size) -@@ -466,15 +466,15 @@ cdef extern from "libxml/xmlmemory.h" nogil: - cdef void xmlMemDisplayLast(stdio.FILE* file, long num_bytes) - cdef void xmlMemShow(stdio.FILE* file, int count) - --cdef extern from "etree_defs.h": -- cdef bint _isElement(xmlNode* node) nogil -- cdef bint _isElementOrXInclude(xmlNode* node) nogil -- cdef const_xmlChar* _getNs(xmlNode* node) nogil -+cdef extern from "etree_defs.h" nogil: -+ cdef bint _isElement(xmlNode* node) -+ cdef bint _isElementOrXInclude(xmlNode* node) -+ cdef const_xmlChar* _getNs(xmlNode* node) - cdef void BEGIN_FOR_EACH_ELEMENT_FROM(xmlNode* tree_top, - xmlNode* start_node, -- bint inclusive) nogil -- cdef void END_FOR_EACH_ELEMENT_FROM(xmlNode* start_node) nogil -+ bint inclusive) -+ cdef void END_FOR_EACH_ELEMENT_FROM(xmlNode* start_node) - cdef void BEGIN_FOR_EACH_FROM(xmlNode* tree_top, - xmlNode* start_node, -- bint inclusive) nogil -- cdef void END_FOR_EACH_FROM(xmlNode* start_node) nogil -+ bint inclusive) -+ cdef void END_FOR_EACH_FROM(xmlNode* start_node) -diff --git a/src/lxml/includes/uri.pxd b/src/lxml/includes/uri.pxd -index 2b6bb79f3..f886a54b9 100644 ---- a/src/lxml/includes/uri.pxd -+++ b/src/lxml/includes/uri.pxd -@@ -1,4 +1,4 @@ --cdef extern from "libxml/uri.h": -+cdef extern from "libxml/uri.h" nogil: - ctypedef struct xmlURI - - cdef xmlURI* xmlParseURI(char* str) -diff --git a/src/lxml/includes/xinclude.pxd b/src/lxml/includes/xinclude.pxd -index 4232d3e43..68267175a 100644 ---- a/src/lxml/includes/xinclude.pxd -+++ b/src/lxml/includes/xinclude.pxd -@@ -1,22 +1,22 @@ - from lxml.includes.tree cimport xmlDoc, xmlNode - --cdef extern from "libxml/xinclude.h": -+cdef extern from "libxml/xinclude.h" nogil: - - ctypedef struct xmlXIncludeCtxt - -- cdef int xmlXIncludeProcess(xmlDoc* doc) nogil -- cdef int xmlXIncludeProcessFlags(xmlDoc* doc, int parser_opts) nogil -- cdef int xmlXIncludeProcessTree(xmlNode* doc) nogil -- cdef int xmlXIncludeProcessTreeFlags(xmlNode* doc, int parser_opts) nogil -+ cdef int xmlXIncludeProcess(xmlDoc* doc) -+ cdef int xmlXIncludeProcessFlags(xmlDoc* doc, int parser_opts) -+ cdef int xmlXIncludeProcessTree(xmlNode* doc) -+ cdef int xmlXIncludeProcessTreeFlags(xmlNode* doc, int parser_opts) - - # libxml2 >= 2.7.4 - cdef int xmlXIncludeProcessTreeFlagsData( -- xmlNode* doc, int parser_opts, void* data) nogil -+ xmlNode* doc, int parser_opts, void* data) - -- cdef xmlXIncludeCtxt* xmlXIncludeNewContext(xmlDoc* doc) nogil -- cdef int xmlXIncludeProcessNode(xmlXIncludeCtxt* ctxt, xmlNode* node) nogil -- cdef int xmlXIncludeSetFlags(xmlXIncludeCtxt* ctxt, int flags) nogil -+ cdef xmlXIncludeCtxt* xmlXIncludeNewContext(xmlDoc* doc) -+ cdef int xmlXIncludeProcessNode(xmlXIncludeCtxt* ctxt, xmlNode* node) -+ cdef int xmlXIncludeSetFlags(xmlXIncludeCtxt* ctxt, int flags) - - # libxml2 >= 2.6.27 - cdef int xmlXIncludeProcessFlagsData( -- xmlDoc* doc, int flags, void* data) nogil -+ xmlDoc* doc, int flags, void* data) -diff --git a/src/lxml/includes/xmlerror.pxd b/src/lxml/includes/xmlerror.pxd -index 13c8f3782..c5ac6a0aa 100644 ---- a/src/lxml/includes/xmlerror.pxd -+++ b/src/lxml/includes/xmlerror.pxd -@@ -823,7 +823,7 @@ cdef extern from "libxml/xmlerror.h": - XML_RELAXNG_ERR_TEXTWRONG = 39 - # --- END: GENERATED CONSTANTS --- - --cdef extern from "libxml/xmlerror.h": -+cdef extern from "libxml/xmlerror.h" nogil: - ctypedef struct xmlError: - int domain - int code -@@ -838,15 +838,15 @@ cdef extern from "libxml/xmlerror.h": - int int2 - void* node - -- ctypedef void (*xmlGenericErrorFunc)(void* ctxt, char* msg, ...) nogil -+ ctypedef void (*xmlGenericErrorFunc)(void* ctxt, char* msg, ...) - ctypedef void (*xmlStructuredErrorFunc)(void* userData, -- xmlError* error) nogil -+ xmlError* error) - - cdef void xmlSetGenericErrorFunc( -- void* ctxt, xmlGenericErrorFunc func) nogil -+ void* ctxt, xmlGenericErrorFunc func) - cdef void xmlSetStructuredErrorFunc( -- void* ctxt, xmlStructuredErrorFunc func) nogil -+ void* ctxt, xmlStructuredErrorFunc func) - --cdef extern from "libxml/globals.h": -+cdef extern from "libxml/globals.h" nogil: - cdef xmlStructuredErrorFunc xmlStructuredError - cdef void* xmlStructuredErrorContext -diff --git a/src/lxml/includes/xmlparser.pxd b/src/lxml/includes/xmlparser.pxd -index 45acfc846..9f3056248 100644 ---- a/src/lxml/includes/xmlparser.pxd -+++ b/src/lxml/includes/xmlparser.pxd -@@ -6,7 +6,7 @@ from lxml.includes.tree cimport xmlInputReadCallback, xmlInputCloseCallback - from lxml.includes.xmlerror cimport xmlError, xmlStructuredErrorFunc - - --cdef extern from "libxml/parser.h": -+cdef extern from "libxml/parser.h" nogil: - ctypedef void (*startElementNsSAX2Func)(void* ctx, - const_xmlChar* localname, - const_xmlChar* prefix, -@@ -49,7 +49,7 @@ cdef extern from "libxml/parser.h": - - cdef int XML_SAX2_MAGIC - --cdef extern from "libxml/tree.h": -+cdef extern from "libxml/tree.h" nogil: - ctypedef struct xmlParserInput: - int line - int length -@@ -93,12 +93,12 @@ cdef extern from "libxml/xmlIO.h" nogil: - cdef xmlParserInputBuffer* xmlAllocParserInputBuffer(int enc) - - --cdef extern from "libxml/parser.h": -+cdef extern from "libxml/parser.h" nogil: - -- cdef xmlDict* xmlDictCreate() nogil -- cdef xmlDict* xmlDictCreateSub(xmlDict* subdict) nogil -- cdef void xmlDictFree(xmlDict* sub) nogil -- cdef int xmlDictReference(xmlDict* dict) nogil -+ cdef xmlDict* xmlDictCreate() -+ cdef xmlDict* xmlDictCreateSub(xmlDict* subdict) -+ cdef void xmlDictFree(xmlDict* sub) -+ cdef int xmlDictReference(xmlDict* dict) - - cdef int XML_COMPLETE_ATTRS # SAX option for adding DTD default attributes - cdef int XML_SKIP_IDS # SAX option for not building an XML ID dict -@@ -181,36 +181,36 @@ cdef extern from "libxml/parser.h": - # libxml2 2.9.0+ only: - XML_PARSE_BIG_LINES = 4194304 # Store big lines numbers in text PSVI field - -- cdef void xmlInitParser() nogil -- cdef void xmlCleanupParser() nogil -+ cdef void xmlInitParser() -+ cdef void xmlCleanupParser() - -- cdef int xmlLineNumbersDefault(int onoff) nogil -- cdef xmlParserCtxt* xmlNewParserCtxt() nogil -+ cdef int xmlLineNumbersDefault(int onoff) -+ cdef xmlParserCtxt* xmlNewParserCtxt() - cdef xmlParserInput* xmlNewIOInputStream(xmlParserCtxt* ctxt, - xmlParserInputBuffer* input, -- int enc) nogil -- cdef int xmlCtxtUseOptions(xmlParserCtxt* ctxt, int options) nogil -- cdef void xmlFreeParserCtxt(xmlParserCtxt* ctxt) nogil -- cdef void xmlCtxtReset(xmlParserCtxt* ctxt) nogil -- cdef void xmlClearParserCtxt(xmlParserCtxt* ctxt) nogil -+ int enc) -+ cdef int xmlCtxtUseOptions(xmlParserCtxt* ctxt, int options) -+ cdef void xmlFreeParserCtxt(xmlParserCtxt* ctxt) -+ cdef void xmlCtxtReset(xmlParserCtxt* ctxt) -+ cdef void xmlClearParserCtxt(xmlParserCtxt* ctxt) - cdef int xmlParseChunk(xmlParserCtxt* ctxt, -- char* chunk, int size, int terminate) nogil -+ char* chunk, int size, int terminate) - cdef xmlDoc* xmlCtxtReadDoc(xmlParserCtxt* ctxt, - char* cur, char* URL, char* encoding, -- int options) nogil -+ int options) - cdef xmlDoc* xmlCtxtReadFile(xmlParserCtxt* ctxt, - char* filename, char* encoding, -- int options) nogil -+ int options) - cdef xmlDoc* xmlCtxtReadIO(xmlParserCtxt* ctxt, - xmlInputReadCallback ioread, - xmlInputCloseCallback ioclose, - void* ioctx, - char* URL, char* encoding, -- int options) nogil -+ int options) - cdef xmlDoc* xmlCtxtReadMemory(xmlParserCtxt* ctxt, - char* buffer, int size, - char* filename, const_char* encoding, -- int options) nogil -+ int options) - - # iterparse: - -@@ -218,33 +218,34 @@ cdef extern from "libxml/parser.h": - void* user_data, - char* chunk, - int size, -- char* filename) nogil -+ char* filename) - - cdef int xmlCtxtResetPush(xmlParserCtxt* ctxt, - char* chunk, - int size, - char* filename, -- char* encoding) nogil -+ char* encoding) - - # entity loaders: - - ctypedef xmlParserInput* (*xmlExternalEntityLoader)( -- const_char * URL, const_char * ID, xmlParserCtxt* context) nogil -- cdef xmlExternalEntityLoader xmlGetExternalEntityLoader() nogil -- cdef void xmlSetExternalEntityLoader(xmlExternalEntityLoader f) nogil -+ const_char * URL, const_char * ID, xmlParserCtxt* context) -+ cdef xmlExternalEntityLoader xmlGetExternalEntityLoader() -+ cdef void xmlSetExternalEntityLoader(xmlExternalEntityLoader f) - - # DTDs: - -- cdef xmlDtd* xmlParseDTD(const_xmlChar* ExternalID, const_xmlChar* SystemID) nogil -+ cdef xmlDtd* xmlParseDTD(const_xmlChar* ExternalID, const_xmlChar* SystemID) - cdef xmlDtd* xmlIOParseDTD(xmlSAXHandler* sax, - xmlParserInputBuffer* input, -- int enc) nogil -+ int enc) - --cdef extern from "libxml/parserInternals.h": -+ -+cdef extern from "libxml/parserInternals.h" nogil: - cdef xmlParserInput* xmlNewInputStream(xmlParserCtxt* ctxt) - cdef xmlParserInput* xmlNewStringInputStream(xmlParserCtxt* ctxt, -- char* buffer) nogil -+ char* buffer) - cdef xmlParserInput* xmlNewInputFromFile(xmlParserCtxt* ctxt, -- char* filename) nogil -- cdef void xmlFreeInputStream(xmlParserInput* input) nogil -- cdef int xmlSwitchEncoding(xmlParserCtxt* ctxt, int enc) nogil -+ char* filename) -+ cdef void xmlFreeInputStream(xmlParserInput* input) -+ cdef int xmlSwitchEncoding(xmlParserCtxt* ctxt, int enc) -diff --git a/src/lxml/includes/xmlschema.pxd b/src/lxml/includes/xmlschema.pxd -index 8e93cc570..067411113 100644 ---- a/src/lxml/includes/xmlschema.pxd -+++ b/src/lxml/includes/xmlschema.pxd -@@ -2,7 +2,7 @@ from lxml.includes.tree cimport xmlDoc - from lxml.includes.xmlparser cimport xmlSAXHandler - from lxml.includes.xmlerror cimport xmlStructuredErrorFunc - --cdef extern from "libxml/xmlschemas.h": -+cdef extern from "libxml/xmlschemas.h" nogil: - ctypedef struct xmlSchema - ctypedef struct xmlSchemaParserCtxt - -diff --git a/src/lxml/includes/xpath.pxd b/src/lxml/includes/xpath.pxd -index d01735b68..22069eb7c 100644 ---- a/src/lxml/includes/xpath.pxd -+++ b/src/lxml/includes/xpath.pxd -@@ -4,7 +4,8 @@ from lxml.includes cimport xmlerror - from libc.string cimport const_char - from lxml.includes.tree cimport xmlChar, const_xmlChar - --cdef extern from "libxml/xpath.h": -+ -+cdef extern from "libxml/xpath.h" nogil: - ctypedef enum xmlXPathObjectType: - XPATH_UNDEFINED = 0 - XPATH_NODESET = 1 -@@ -73,63 +74,63 @@ cdef extern from "libxml/xpath.h": - - ctypedef struct xmlXPathCompExpr - -- ctypedef void (*xmlXPathFunction)(xmlXPathParserContext* ctxt, int nargs) nogil -+ ctypedef void (*xmlXPathFunction)(xmlXPathParserContext* ctxt, int nargs) - ctypedef xmlXPathFunction (*xmlXPathFuncLookupFunc)(void* ctxt, - const_xmlChar* name, -- const_xmlChar* ns_uri) nogil -+ const_xmlChar* ns_uri) - -- cdef xmlXPathContext* xmlXPathNewContext(tree.xmlDoc* doc) nogil -+ cdef xmlXPathContext* xmlXPathNewContext(tree.xmlDoc* doc) - cdef xmlXPathObject* xmlXPathEvalExpression(const_xmlChar* str, -- xmlXPathContext* ctxt) nogil -+ xmlXPathContext* ctxt) - cdef xmlXPathObject* xmlXPathCompiledEval(xmlXPathCompExpr* comp, -- xmlXPathContext* ctxt) nogil -- cdef xmlXPathCompExpr* xmlXPathCompile(const_xmlChar* str) nogil -+ xmlXPathContext* ctxt) -+ cdef xmlXPathCompExpr* xmlXPathCompile(const_xmlChar* str) - cdef xmlXPathCompExpr* xmlXPathCtxtCompile(xmlXPathContext* ctxt, -- const_xmlChar* str) nogil -- cdef void xmlXPathFreeContext(xmlXPathContext* ctxt) nogil -- cdef void xmlXPathFreeCompExpr(xmlXPathCompExpr* comp) nogil -- cdef void xmlXPathFreeObject(xmlXPathObject* obj) nogil -+ const_xmlChar* str) -+ cdef void xmlXPathFreeContext(xmlXPathContext* ctxt) -+ cdef void xmlXPathFreeCompExpr(xmlXPathCompExpr* comp) -+ cdef void xmlXPathFreeObject(xmlXPathObject* obj) - cdef int xmlXPathRegisterNs(xmlXPathContext* ctxt, -- const_xmlChar* prefix, const_xmlChar* ns_uri) nogil -+ const_xmlChar* prefix, const_xmlChar* ns_uri) - -- cdef xmlNodeSet* xmlXPathNodeSetCreate(tree.xmlNode* val) nogil -- cdef void xmlXPathFreeNodeSet(xmlNodeSet* val) nogil -+ cdef xmlNodeSet* xmlXPathNodeSetCreate(tree.xmlNode* val) -+ cdef void xmlXPathFreeNodeSet(xmlNodeSet* val) - - --cdef extern from "libxml/xpathInternals.h": -+cdef extern from "libxml/xpathInternals.h" nogil: - cdef int xmlXPathRegisterFunc(xmlXPathContext* ctxt, - const_xmlChar* name, -- xmlXPathFunction f) nogil -+ xmlXPathFunction f) - cdef int xmlXPathRegisterFuncNS(xmlXPathContext* ctxt, - const_xmlChar* name, - const_xmlChar* ns_uri, -- xmlXPathFunction f) nogil -+ xmlXPathFunction f) - cdef void xmlXPathRegisterFuncLookup(xmlXPathContext *ctxt, - xmlXPathFuncLookupFunc f, -- void *funcCtxt) nogil -+ void *funcCtxt) - cdef int xmlXPathRegisterVariable(xmlXPathContext *ctxt, - const_xmlChar* name, -- xmlXPathObject* value) nogil -+ xmlXPathObject* value) - cdef int xmlXPathRegisterVariableNS(xmlXPathContext *ctxt, - const_xmlChar* name, - const_xmlChar* ns_uri, -- xmlXPathObject* value) nogil -- cdef void xmlXPathRegisteredVariablesCleanup(xmlXPathContext *ctxt) nogil -- cdef void xmlXPathRegisteredNsCleanup(xmlXPathContext *ctxt) nogil -- cdef xmlXPathObject* valuePop (xmlXPathParserContext *ctxt) nogil -- cdef int valuePush(xmlXPathParserContext* ctxt, xmlXPathObject *value) nogil -+ xmlXPathObject* value) -+ cdef void xmlXPathRegisteredVariablesCleanup(xmlXPathContext *ctxt) -+ cdef void xmlXPathRegisteredNsCleanup(xmlXPathContext *ctxt) -+ cdef xmlXPathObject* valuePop (xmlXPathParserContext *ctxt) -+ cdef int valuePush(xmlXPathParserContext* ctxt, xmlXPathObject *value) - -- cdef xmlXPathObject* xmlXPathNewCString(const_char *val) nogil -- cdef xmlXPathObject* xmlXPathWrapCString(const_char * val) nogil -- cdef xmlXPathObject* xmlXPathNewString(const_xmlChar *val) nogil -- cdef xmlXPathObject* xmlXPathWrapString(const_xmlChar * val) nogil -- cdef xmlXPathObject* xmlXPathNewFloat(double val) nogil -- cdef xmlXPathObject* xmlXPathNewBoolean(int val) nogil -- cdef xmlXPathObject* xmlXPathNewNodeSet(tree.xmlNode* val) nogil -- cdef xmlXPathObject* xmlXPathNewValueTree(tree.xmlNode* val) nogil -+ cdef xmlXPathObject* xmlXPathNewCString(const_char *val) -+ cdef xmlXPathObject* xmlXPathWrapCString(const_char * val) -+ cdef xmlXPathObject* xmlXPathNewString(const_xmlChar *val) -+ cdef xmlXPathObject* xmlXPathWrapString(const_xmlChar * val) -+ cdef xmlXPathObject* xmlXPathNewFloat(double val) -+ cdef xmlXPathObject* xmlXPathNewBoolean(int val) -+ cdef xmlXPathObject* xmlXPathNewNodeSet(tree.xmlNode* val) -+ cdef xmlXPathObject* xmlXPathNewValueTree(tree.xmlNode* val) - cdef void xmlXPathNodeSetAdd(xmlNodeSet* cur, -- tree.xmlNode* val) nogil -+ tree.xmlNode* val) - cdef void xmlXPathNodeSetAddUnique(xmlNodeSet* cur, -- tree.xmlNode* val) nogil -- cdef xmlXPathObject* xmlXPathWrapNodeSet(xmlNodeSet* val) nogil -- cdef void xmlXPathErr(xmlXPathParserContext* ctxt, int error) nogil -+ tree.xmlNode* val) -+ cdef xmlXPathObject* xmlXPathWrapNodeSet(xmlNodeSet* val) -+ cdef void xmlXPathErr(xmlXPathParserContext* ctxt, int error) -diff --git a/src/lxml/includes/xslt.pxd b/src/lxml/includes/xslt.pxd -index 101fb7e78..05d2d4b9b 100644 ---- a/src/lxml/includes/xslt.pxd -+++ b/src/lxml/includes/xslt.pxd -@@ -11,7 +11,7 @@ cdef extern from "libxslt/xslt.h": - cdef extern from "libxslt/xsltconfig.h": - cdef int LIBXSLT_VERSION - --cdef extern from "libxslt/xsltInternals.h": -+cdef extern from "libxslt/xsltInternals.h" nogil: - ctypedef enum xsltTransformState: - XSLT_STATE_OK # 0 - XSLT_STATE_ERROR # 1 -@@ -42,35 +42,35 @@ cdef extern from "libxslt/xsltInternals.h": - - ctypedef struct xsltTemplate - -- cdef xsltStylesheet* xsltParseStylesheetDoc(xmlDoc* doc) nogil -- cdef void xsltFreeStylesheet(xsltStylesheet* sheet) nogil -+ cdef xsltStylesheet* xsltParseStylesheetDoc(xmlDoc* doc) -+ cdef void xsltFreeStylesheet(xsltStylesheet* sheet) - --cdef extern from "libxslt/imports.h": -+cdef extern from "libxslt/imports.h" nogil: - # actually defined in "etree_defs.h" - cdef void LXML_GET_XSLT_ENCODING(const_xmlChar* result_var, xsltStylesheet* style) - --cdef extern from "libxslt/extensions.h": -+cdef extern from "libxslt/extensions.h" nogil: - ctypedef void (*xsltTransformFunction)(xsltTransformContext* ctxt, - xmlNode* context_node, - xmlNode* inst, -- void* precomp_unused) nogil -+ void* precomp_unused) - - cdef int xsltRegisterExtFunction(xsltTransformContext* ctxt, - const_xmlChar* name, - const_xmlChar* URI, -- xmlXPathFunction function) nogil -+ xmlXPathFunction function) - cdef int xsltRegisterExtModuleFunction(const_xmlChar* name, const_xmlChar* URI, -- xmlXPathFunction function) nogil -+ xmlXPathFunction function) - cdef int xsltUnregisterExtModuleFunction(const_xmlChar* name, const_xmlChar* URI) - cdef xmlXPathFunction xsltExtModuleFunctionLookup( -- const_xmlChar* name, const_xmlChar* URI) nogil -+ const_xmlChar* name, const_xmlChar* URI) - cdef int xsltRegisterExtPrefix(xsltStylesheet* style, -- const_xmlChar* prefix, const_xmlChar* URI) nogil -+ const_xmlChar* prefix, const_xmlChar* URI) - cdef int xsltRegisterExtElement(xsltTransformContext* ctxt, - const_xmlChar* name, const_xmlChar* URI, -- xsltTransformFunction function) nogil -+ xsltTransformFunction function) - --cdef extern from "libxslt/documents.h": -+cdef extern from "libxslt/documents.h" nogil: - ctypedef enum xsltLoadType: - XSLT_LOAD_START - XSLT_LOAD_STYLESHEET -@@ -79,48 +79,48 @@ cdef extern from "libxslt/documents.h": - ctypedef xmlDoc* (*xsltDocLoaderFunc)(const_xmlChar* URI, xmlDict* dict, - int options, - void* ctxt, -- xsltLoadType type) nogil -+ xsltLoadType type) - cdef xsltDocLoaderFunc xsltDocDefaultLoader -- cdef void xsltSetLoaderFunc(xsltDocLoaderFunc f) nogil -+ cdef void xsltSetLoaderFunc(xsltDocLoaderFunc f) - --cdef extern from "libxslt/transform.h": -+cdef extern from "libxslt/transform.h" nogil: - cdef xmlDoc* xsltApplyStylesheet(xsltStylesheet* style, xmlDoc* doc, -- const_char** params) nogil -+ const_char** params) - cdef xmlDoc* xsltApplyStylesheetUser(xsltStylesheet* style, xmlDoc* doc, - const_char** params, const_char* output, - void* profile, -- xsltTransformContext* context) nogil -+ xsltTransformContext* context) - cdef void xsltProcessOneNode(xsltTransformContext* ctxt, - xmlNode* contextNode, -- xsltStackElem* params) nogil -+ xsltStackElem* params) - cdef xsltTransformContext* xsltNewTransformContext(xsltStylesheet* style, -- xmlDoc* doc) nogil -- cdef void xsltFreeTransformContext(xsltTransformContext* context) nogil -+ xmlDoc* doc) -+ cdef void xsltFreeTransformContext(xsltTransformContext* context) - cdef void xsltApplyOneTemplate(xsltTransformContext* ctxt, - xmlNode* contextNode, xmlNode* list, - xsltTemplate* templ, -- xsltStackElem* params) nogil -+ xsltStackElem* params) - - --cdef extern from "libxslt/xsltutils.h": -+cdef extern from "libxslt/xsltutils.h" nogil: - cdef int xsltSaveResultToString(xmlChar** doc_txt_ptr, - int* doc_txt_len, - xmlDoc* result, -- xsltStylesheet* style) nogil -+ xsltStylesheet* style) - cdef int xsltSaveResultToFilename(const_char *URL, - xmlDoc* result, - xsltStylesheet* style, -- int compression) nogil -+ int compression) - cdef int xsltSaveResultTo(xmlOutputBuffer* buf, - xmlDoc* result, -- xsltStylesheet* style) nogil -+ xsltStylesheet* style) - cdef xmlGenericErrorFunc xsltGenericError - cdef void *xsltGenericErrorContext - cdef void xsltSetGenericErrorFunc( -- void* ctxt, void (*handler)(void* ctxt, char* msg, ...)) nogil -+ void* ctxt, void (*handler)(void* ctxt, char* msg, ...) nogil) - cdef void xsltSetTransformErrorFunc( - xsltTransformContext*, void* ctxt, -- void (*handler)(void* ctxt, char* msg, ...) nogil) nogil -+ void (*handler)(void* ctxt, char* msg, ...) nogil) - cdef void xsltTransformError(xsltTransformContext* ctxt, - xsltStylesheet* style, - xmlNode* node, char* msg, ...) -@@ -128,7 +128,7 @@ cdef extern from "libxslt/xsltutils.h": - xsltTransformContext* ctxt, int options) - - --cdef extern from "libxslt/security.h": -+cdef extern from "libxslt/security.h" nogil: - ctypedef struct xsltSecurityPrefs - ctypedef enum xsltSecurityOption: - XSLT_SECPREF_READ_FILE = 1 -@@ -139,44 +139,44 @@ cdef extern from "libxslt/security.h": - - ctypedef int (*xsltSecurityCheck)(xsltSecurityPrefs* sec, - xsltTransformContext* ctxt, -- char* value) nogil -+ char* value) - -- cdef xsltSecurityPrefs* xsltNewSecurityPrefs() nogil -- cdef void xsltFreeSecurityPrefs(xsltSecurityPrefs* sec) nogil -+ cdef xsltSecurityPrefs* xsltNewSecurityPrefs() -+ cdef void xsltFreeSecurityPrefs(xsltSecurityPrefs* sec) - cdef int xsltSecurityForbid(xsltSecurityPrefs* sec, - xsltTransformContext* ctxt, -- char* value) nogil -+ char* value) - cdef int xsltSecurityAllow(xsltSecurityPrefs* sec, - xsltTransformContext* ctxt, -- char* value) nogil -+ char* value) - cdef int xsltSetSecurityPrefs(xsltSecurityPrefs* sec, - xsltSecurityOption option, -- xsltSecurityCheck func) nogil -+ xsltSecurityCheck func) - cdef xsltSecurityCheck xsltGetSecurityPrefs( - xsltSecurityPrefs* sec, -- xsltSecurityOption option) nogil -+ xsltSecurityOption option) - cdef int xsltSetCtxtSecurityPrefs(xsltSecurityPrefs* sec, -- xsltTransformContext* ctxt) nogil -- cdef xmlDoc* xsltGetProfileInformation(xsltTransformContext* ctxt) nogil -+ xsltTransformContext* ctxt) -+ cdef xmlDoc* xsltGetProfileInformation(xsltTransformContext* ctxt) - --cdef extern from "libxslt/variables.h": -+cdef extern from "libxslt/variables.h" nogil: - cdef int xsltQuoteUserParams(xsltTransformContext* ctxt, - const_char** params) - cdef int xsltQuoteOneUserParam(xsltTransformContext* ctxt, - const_xmlChar* name, - const_xmlChar* value) - --cdef extern from "libxslt/extra.h": -+cdef extern from "libxslt/extra.h" nogil: - const_xmlChar* XSLT_LIBXSLT_NAMESPACE - const_xmlChar* XSLT_XALAN_NAMESPACE - const_xmlChar* XSLT_SAXON_NAMESPACE - const_xmlChar* XSLT_XT_NAMESPACE - - cdef xmlXPathFunction xsltFunctionNodeSet -- cdef void xsltRegisterAllExtras() nogil -+ cdef void xsltRegisterAllExtras() - --cdef extern from "libexslt/exslt.h": -- cdef void exsltRegisterAll() nogil -+cdef extern from "libexslt/exslt.h" nogil: -+ cdef void exsltRegisterAll() - - # libexslt 1.1.25+ - const_xmlChar* EXSLT_DATE_NAMESPACE -@@ -188,4 +188,3 @@ cdef extern from "libexslt/exslt.h": - cdef int exsltSetsXpathCtxtRegister(xmlXPathContext* ctxt, const_xmlChar* prefix) - cdef int exsltMathXpathCtxtRegister(xmlXPathContext* ctxt, const_xmlChar* prefix) - cdef int exsltStrXpathCtxtRegister(xmlXPathContext* ctxt, const_xmlChar* prefix) -- diff --git a/python-lxml.spec b/python-lxml.spec index 3d87fe4..f82defd 100644 --- a/python-lxml.spec +++ b/python-lxml.spec @@ -1,5 +1,5 @@ Name: python-lxml -Version: 4.9.4 +Version: 5.1.0 Release: 1%{?dist} Summary: XML processing library combining libxml2/libxslt with the ElementTree API @@ -16,25 +16,6 @@ URL: https://github.com/lxml/lxml Source0: lxml-%{version}-no-isoschematron-rng.tar.gz Source1: get-lxml-source.sh -# Make the validation of ISO-Schematron files optional in lxml, -# depending on the availability of the RNG validation file -# Rebased from https://github.com/lxml/lxml/commit/4bfab2c821961fb4c5ed8a04e329778c9b09a1df -# Will be included in lxml 5.0 -Patch: Make-the-validation-of-ISO-Schematron-files-optional.patch -# Skip test_isoschematron.test_schematron_invalid_schema_empty without the RNG file -Patch: https://github.com/lxml/lxml/pull/380.patch - -# Upstream issue: https://bugs.launchpad.net/lxml/+bug/2016939 -Patch: Skip-failing-test-test_html_prefix_nsmap.patch - -# Cython 3 support backported from future lxml 5.0 -Patch: https://github.com/lxml/lxml/commit/dcbc0cc1cb0cedf8019184aaca805d2a649cd8de.patch -Patch: https://github.com/lxml/lxml/commit/a03a4b3c6b906d33c5ef1a15f3d5ca5fff600c76.patch - -# Python 3.13 compatibility -Patch: https://github.com/lxml/lxml/commit/34187968a67151f02db491a56a0037b55319931d.patch -Patch: https://github.com/lxml/lxml/commit/98025653e182f9203189cbde0ab2d6ebec556db8.patch - BuildRequires: gcc BuildRequires: libxml2-devel BuildRequires: libxslt-devel @@ -79,6 +60,7 @@ Python 3 version. # Remove limit for version of Cython sed -i "s/Cython.*/Cython/" requirements.txt +sed -i 's/"Cython.*",/"Cython",/' pyproject.toml %generate_buildrequires %pyproject_buildrequires -x source%{?with_extras:,cssselect,html5,htmlsoup} @@ -107,6 +89,9 @@ cp -a build/lib.%{python3_platform}-*/* src/ %doc README.rst %changelog +* Mon Jan 08 2024 Lumír Balhar - 5.1.0-1 +- Update to 5.1.0 (rhbz#2256232) + * Wed Dec 20 2023 Lumír Balhar - 4.9.4-1 - Update to 4.9.4 (rhbz#2255267) diff --git a/sources b/sources index 4d0d50a..c2b3845 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (lxml-4.9.4-no-isoschematron-rng.tar.gz) = 0519d6d58537d870fd862fa9f9256cca85162720eb417e2f532d000ab0faf25121b947746517c0a5df56c9d89e5cf5069a3a90f0fe116b2e6378329f2330c8ac +SHA512 (lxml-5.1.0-no-isoschematron-rng.tar.gz) = f4b65c0189c89742fb4be6a3e73b08e7e7338272b71482e64be75dc8d53cebc769c0520a86a46579328fa0ec4377bb2bd860338550b1098d26c8f509fcedc664 From 3a10d475bb9d8cecc8fd6c82af9b64d1cd9bdc5f Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Mon, 22 Jan 2024 03:09:29 +0000 Subject: [PATCH 21/47] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- python-lxml.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-lxml.spec b/python-lxml.spec index f82defd..4561f2b 100644 --- a/python-lxml.spec +++ b/python-lxml.spec @@ -1,6 +1,6 @@ Name: python-lxml Version: 5.1.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: XML processing library combining libxml2/libxslt with the ElementTree API # The lxml project is licensed under BSD-3-Clause @@ -89,6 +89,9 @@ cp -a build/lib.%{python3_platform}-*/* src/ %doc README.rst %changelog +* Mon Jan 22 2024 Fedora Release Engineering - 5.1.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Mon Jan 08 2024 Lumír Balhar - 5.1.0-1 - Update to 5.1.0 (rhbz#2256232) From e38670104ec9d85949f307639fbed2d1a819a9b2 Mon Sep 17 00:00:00 2001 From: Tomas Orsava Date: Mon, 29 Jan 2024 10:30:12 +0100 Subject: [PATCH 22/47] Fixing whitespace --- python-lxml.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python-lxml.spec b/python-lxml.spec index 4561f2b..c5b893a 100644 --- a/python-lxml.spec +++ b/python-lxml.spec @@ -13,8 +13,8 @@ URL: https://github.com/lxml/lxml # We use the get-lxml-source.sh script to generate the tarball # without the isoschematron RNG validation file under a problematic license. # See: https://gitlab.com/fedora/legal/fedora-license-data/-/issues/154 -Source0: lxml-%{version}-no-isoschematron-rng.tar.gz -Source1: get-lxml-source.sh +Source0: lxml-%{version}-no-isoschematron-rng.tar.gz +Source1: get-lxml-source.sh BuildRequires: gcc BuildRequires: libxml2-devel From 009f7659b73a25b58b7d10a86419ffbb22b76280 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Mon, 29 Jan 2024 19:14:58 +0100 Subject: [PATCH 23/47] Convert to %autorelease and %autochangelog [skip changelog] --- changelog | 1642 +++++++++++++++++++++++++++++++++++++++++++++ python-lxml.spec | 1645 +--------------------------------------------- 2 files changed, 1644 insertions(+), 1643 deletions(-) create mode 100644 changelog diff --git a/changelog b/changelog new file mode 100644 index 0000000..b2226da --- /dev/null +++ b/changelog @@ -0,0 +1,1642 @@ +* Mon Jan 22 2024 Fedora Release Engineering - 5.1.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Mon Jan 08 2024 Lumír Balhar - 5.1.0-1 +- Update to 5.1.0 (rhbz#2256232) + +* Wed Dec 20 2023 Lumír Balhar - 4.9.4-1 +- Update to 4.9.4 (rhbz#2255267) + +* Sun Nov 26 2023 David King - 4.9.3-4 +- Fix building against libxml2 2.12.0 +- Resolves: rhbz#2250838 + +* Mon Oct 30 2023 Miro Hrončok - 4.9.3-3 +- Fix build with a future mock version + +* Fri Jul 28 2023 Miro Hrončok - 4.9.3-2 +- Fix build with Cython 3 + +* Fri Jul 21 2023 Lumír Balhar - 4.9.3-1 +- Update to 4.9.3 (rhbz#2219811) + +* Fri Jul 21 2023 Fedora Release Engineering - 4.9.2-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Fri Jul 14 2023 Miro Hrončok - 4.9.2-8 +- Bring back the isoschematron submodule, + but without the validation of the schema file itself + +* Fri Jun 16 2023 Python Maint - 4.9.2-7 +- Rebuilt for Python 3.12 + +* Tue Jun 13 2023 Python Maint - 4.9.2-6 +- Bootstrap for Python 3.12 + +* Wed May 31 2023 Miro Hrončok - 4.9.2-5 +- Remove the isoschematron submodule + +* Tue May 30 2023 Yaakov Selkowitz - 4.9.2-4 +- Disable extra subpackages in RHEL builds + +* Mon May 29 2023 Tomáš Hrnčiar - 4.9.2-3 +- Skip failing test to avoid FTBFS + +* Fri Jan 20 2023 Fedora Release Engineering - 4.9.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Wed Dec 14 2022 Lumír Balhar - 4.9.2-1 +- Update to 4.9.2 (rhbz#2153063) + +* Wed Sep 14 2022 Charalampos Stratakis - 4.9.1-1 +- Update to 4.9.1 +- Fix for CVE-2022-2309 +- Resolves: rhbz#2107571, rhbz#2110131 + +* Wed Aug 31 2022 Miro Hrončok - 4.7.1-6 +- Use SPDX license identifiers +- The schematron files are not Zlib licensed, but MIT +- Package the lxml[cssselect], lxml[html5] and lxml[htmlsoup] extras + +* Fri Jul 22 2022 Fedora Release Engineering - 4.7.1-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Wed Jun 22 2022 Charalampos Stratakis - 4.7.1-4 +- Fix FTBFS with setuptools >= 62.1 +- Resolves: rhbz#2097102 + +* Mon Jun 13 2022 Python Maint - 4.7.1-3 +- Rebuilt for Python 3.11 + +* Fri Jan 21 2022 Fedora Release Engineering - 4.7.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Thu Jan 06 2022 Charalampos Stratakis - 4.7.1-1 +- Update to 4.7.1 +- Fixes CVE-2021-43818 +- Resolves: rhbz#2031686, rhbz#2032572 + +* Fri Nov 26 2021 Miro Hrončok - 4.6.3-5 +- Run the tests during build +- Resolves: rhbz#2026941 + +* Fri Jul 23 2021 Fedora Release Engineering - 4.6.3-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Thu Jun 03 2021 Charalampos Stratakis - 4.6.3-3 +- Update the license information + +* Wed Jun 02 2021 Python Maint - 4.6.3-2 +- Rebuilt for Python 3.10 + +* Thu May 20 2021 Charalampos Stratakis - 4.6.3-1 +- Update to 4.6.3 +- Fixes CVE-2021-28957 +- Fixes: rhbz#1941773 +- Fixes: rhbz#1941535 + +* Wed Jan 27 2021 Fedora Release Engineering - 4.6.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Tue Dec 01 2020 Miro Hrončok - 4.6.2-1 +- Update to 4.6.2 +- Fixes CVE-2020-27783 and another vulnerability in the HTML Cleaner +- Fixes: rhbz#1855415 +- Fixes: rhbz#1901634 + +* Wed Jul 29 2020 Fedora Release Engineering - 4.5.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Mon Jun 01 2020 Igor Raits - 4.5.1-1 +- Update to 4.5.1 + +* Fri May 22 2020 Miro Hrončok - 4.4.1-5 +- Rebuilt for Python 3.9 + +* Thu Jan 30 2020 Fedora Release Engineering - 4.4.1-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Wed Nov 20 2019 Miro Hrončok - 4.4.1-3 +- Subpackage python2-lxml has been removed + See https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal + +* Sat Sep 07 2019 Igor Gnatenko - 4.4.1-2 +- Generate C files using py3 Cython + +* Sat Sep 07 2019 Igor Gnatenko - 4.4.1-1 +- Update to 4.4.1 + +* Fri Aug 16 2019 Miro Hrončok - 4.4.0-2 +- Rebuilt for Python 3.8 + +* Sat Aug 03 2019 Igor Gnatenko - 4.4.0-1 +- Update to 4.4.0 + +* Fri Jul 26 2019 Fedora Release Engineering - 4.2.5-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Sat Feb 02 2019 Fedora Release Engineering - 4.2.5-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Tue Dec 18 2018 Igor Gnatenko - 4.2.5-1 +- Update to 4.2.5 + +* Sun Sep 02 2018 Igor Gnatenko - 4.2.4-1 +- Update to 4.2.4 + +* Sat Jul 14 2018 Fedora Release Engineering - 4.2.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Sat Jul 07 2018 Igor Gnatenko - 4.2.3-1 +- Update to 4.2.3 + +* Sun Jun 17 2018 Miro Hrončok - 4.2.1-2 +- Rebuilt for Python 3.7 + +* Wed Apr 25 2018 Igor Gnatenko - 4.2.1-1 +- Update to 4.2.1 + +* Fri Feb 09 2018 Fedora Release Engineering - 4.1.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Sun Nov 05 2017 Igor Gnatenko - 4.1.1-1 +- Update to 4.1.1 + +* Tue Oct 10 2017 Mikolaj Izdebski - 4.0.0-2 +- Conditionally allow building without Cython + +* Thu Oct 05 2017 Igor Gnatenko - 4.0.0-1 +- Update to 4.0.0 + +* Sat Aug 12 2017 Kevin Fenzi - 3.8.0-1 +- Update to 3.8.0. Fixes bug #1458529 + +* Thu Aug 03 2017 Fedora Release Engineering - 3.7.2-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Thu Jul 27 2017 Fedora Release Engineering - 3.7.2-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Sat Feb 11 2017 Fedora Release Engineering - 3.7.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Mon Jan 09 2017 Fabio Alessandro Locati - 3.7.2-1 +- Update to 3.7.2 + +* Sun Dec 25 2016 Fabio Alessandro Locati - 3.7.1-1 +- Update to 3.7.1 + +* Tue Dec 13 2016 Stratakis Charalampos - 3.7.0-2 +- Rebuild for Python 3.6 + +* Sun Dec 11 2016 Fabio Alessandro Locati - 3.7.0-1 +- Update to 3.7.0 + +* Thu Sep 08 2016 Fabio Alessandro Locati - 3.6.4-1 +- Update to 3.6.4 + +* Tue Jul 19 2016 Fedora Release Engineering - 3.4.4-5 +- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages + +* Thu Feb 04 2016 Fedora Release Engineering - 3.4.4-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Thu Jan 21 2016 Dan Horák - 3.4.4-3 +- fix conditional + +* Fri Nov 06 2015 Robert Kuska - 3.4.4-2 +- Rebuilt for Python3.5 rebuild + +* Fri Aug 28 2015 Peter Robinson 3.4.4-1 +- Update to 3.4.4 +- Use %%license, cleanup spec + +* Thu Jun 18 2015 Fedora Release Engineering - 3.3.6-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Fri Aug 29 2014 Jeffrey C. Ollie - 3.3.6-1 +- 3.3.6 (2014-08-28) +- ================== +- +- Bugs fixed +- ---------- +- +- * Prevent tree cycle creation when adding Elements as siblings. +- +- * LP#1361948: crash when deallocating Element siblings without parent. +- +- * LP#1354652: crash when traversing internally loaded documents in XSLT +- extension functions. + +* Sun Aug 17 2014 Fedora Release Engineering +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Sat Jun 07 2014 Fedora Release Engineering - 3.3.5-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Wed May 14 2014 Bohuslav Kabrda - 3.3.5-2 +- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4 + +* Mon Apr 28 2014 Jeffrey Ollie - 3.3.5-1 +- 3.3.5 (2014-04-18) +- ================== +- +- Bugs fixed +- ---------- +- +- * HTML cleaning could fail to strip javascript links that mix control +- characters into the link scheme. + +* Mon Apr 28 2014 Jeffrey Ollie - 3.3.4-1 +- 3.3.4 (2014-04-03) +- ================== +- +- Features added +- -------------- +- +- * Source line numbers above 65535 are available on Elements when +- using libxml2 2.9 or later. +- +- Bugs fixed +- ---------- +- +- * lxml.html.fragment_fromstring() failed for bytes input in Py3. + +* Wed Mar 26 2014 Jeffrey Ollie - 3.3.3-4 +- Fix macro definition + +* Wed Mar 26 2014 Jeffrey Ollie - 3.3.3-3 +- Add python3-cssselect to correct package + +* Mon Mar 24 2014 Jeffrey Ollie - 3.3.3-3 +- python3-cssselect is not available on F19 + +* Mon Mar 24 2014 Jeffrey Ollie - 3.3.3-2 +- BZ#1075070 add requires and buildrequires for cssselect + +* Tue Mar 11 2014 Jeffrey Ollie - 3.3.3-1 +- 3.3.3 (2014-03-04) +- ================== +- +- Bugs fixed +- ---------- +- +- * LP#1287118: Crash when using Element subtypes with ``__slots__``. +- +- Other changes +- ------------- +- +- * The internal classes ``_LogEntry`` and ``_Attrib`` can no longer be +- subclassed from Python code. + +* Tue Mar 11 2014 Alexander Todorov - 3.3.2-2 +- Add check section #1075070 + +* Fri Feb 28 2014 Jeffrey Ollie - 3.3.2-1 +- 3.3.2 (2014-02-26) +- ================== +- +- Bugs fixed +- ---------- +- +- * The properties ``resolvers`` and ``version``, as well as the methods +- ``set_element_class_lookup()`` and ``makeelement()``, were lost from +- ``iterparse`` objects. +- +- * LP#1222132: instances of ``XMLSchema``, ``Schematron`` and ``RelaxNG`` +- did not clear their local ``error_log`` before running a validation. +- +- * LP#1238500: lxml.doctestcompare mixed up "expected" and "actual" in +- attribute values. +- +- * Some file I/O tests were failing in MS-Windows due to incorrect temp +- file usage. Initial patch by Gabi Davar. +- +- * LP#910014: duplicate IDs in a document were not reported by DTD +- validation. +- +- * LP#1185332: ``tostring(method="html")`` did not use HTML serialisation +- semantics for trailing tail text. Initial patch by Sylvain Viollon. +- +- * LP#1281139: ``.attrib`` value of Comments lost its mutation methods +- in 3.3.0. Even though it is empty and immutable, it should still +- provide the same interface as that returned for Elements. + +* Fri Feb 28 2014 Jeffrey Ollie - 3.3.2-1 +- 3.3.1 (2014-02-12) +- ================== +- +- Bugs fixed +- ---------- +- +- * LP#1014290: HTML documents parsed with ``parser.feed()`` failed to find +- elements during tag iteration. +- +- * LP#1273709: Building in PyPy failed due to missing support for +- ``PyUnicode_Compare()`` and ``PyByteArray_*()`` in PyPy's C-API. +- +- * LP#1274413: Compilation in MSVC failed due to missing "stdint.h" standard +- header file. +- +- * LP#1274118: iterparse() failed to parse BOM prefixed files. + +* Mon Jan 27 2014 Jeffrey Ollie - 3.3.0-2 +- Update Cython requirement to >= 0.20 + +* Mon Jan 27 2014 Jeffrey Ollie - 3.3.0-1 +- 3.3.0 (2014-01-26) +- ================== +- +- Features added +- -------------- +- +- Bugs fixed +- ---------- +- +- * The heuristic that distinguishes file paths from URLs was tightened +- to produce less false negatives. +- +- Other changes +- ------------- +- +- +- 3.3.0beta5 (2014-01-18) +- ======================= +- +- Features added +- -------------- +- +- * The PEP 393 unicode parsing support gained a fallback for wchar strings +- which might still be somewhat common on Windows systems. +- +- Bugs fixed +- ---------- +- +- * Several error handling problems were fixed throughout the code base that +- could previously lead to exceptions being silently swallowed or not +- properly reported. +- +- * The C-API function ``appendChild()`` is now deprecated as it does not +- propagate exceptions (its return type is ``void``). The new function +- ``appendChildToElement()`` was added as a safe replacement. +- +- * Passing a string into ``fromstringlist()`` raises an exception instead of +- parsing the string character by character. +- +- Other changes +- ------------- +- +- * Document cleanup code was simplified using the new GC features in +- Cython 0.20. +- +- +- 3.3.0beta4 (2014-01-12) +- ======================= +- +- Features added +- -------------- +- +- Bugs fixed +- ---------- +- +- * The (empty) value returned by the ``attrib`` property of Entity and +- Comment objects was mutable. +- +- * Element class lookup wasn't available for the new pull parsers or when +- using a custom parser target. +- +- * Setting Element attributes on instantiation with both the ``attrib`` +- argument and keyword arguments could modify the mapping passed as +- ``attrib``. +- +- * LP#1266171: DTDs instantiated from internal/external subsets (i.e. +- through the docinfo property) lost their attribute declarations. +- +- Other changes +- ------------- +- +- * Built with Cython 0.20pre (gitrev 012ae82eb) to prepare support for +- Python 3.4. +- +- +- 3.3.0beta3 (2014-01-02) +- ======================= +- +- Features added +- -------------- +- +- * Unicode string parsing was optimised for Python 3.3 (PEP 393). +- +- Bugs fixed +- ---------- +- +- * HTML parsing of Unicode strings could misdecode the input on some +- platforms. +- +- * Crash in xmlfile() when closing open elements out of order in an error +- case. +- +- Other changes +- ------------- +- +- +- 3.3.0beta2 (2013-12-20) +- ======================= +- +- Features added +- -------------- +- +- * ``iterparse()`` supports the ``recover`` option. +- +- Bugs fixed +- ---------- +- +- * Crash in ``iterparse()`` for HTML parsing. +- +- * Crash in target parsing with attributes. +- +- Other changes +- ------------- +- +- * The safety check in the read-only tree implementation (e.g. used by +- ``PythonElementClassLookup``) raises a more appropriate +- ``ReferenceError`` for illegal access after tree disposal instead of +- an ``AssertionError``. This should only impact test code that +- specifically checks the original behaviour. +- +- +- 3.3.0beta1 (2013-12-12) +- ======================= +- +- Features added +- -------------- +- +- * New option ``handle_failures`` in ``make_links_absolute()`` and +- ``resolve_base_href()`` (lxml.html) that enables ignoring or +- discarding links that fail to parse as URLs. +- +- * New parser classes ``XMLPullParser`` and ``HTMLPullParser`` for +- incremental parsing, as implemented for ElementTree in Python 3.4. +- +- * ``iterparse()`` enables recovery mode by default for HTML parsing +- (``html=True``). +- +- Bugs fixed +- ---------- +- +- * LP#1255132: crash when trying to run validation over non-Element (e.g. +- comment or PI). +- +- * Error messages in the log and in exception messages that originated +- from libxml2 could accidentally be picked up from preceding warnings +- instead of the actual error. +- +- * The ``ElementMaker`` in lxml.objectify did not accept a dict as +- argument for adding attributes to the element it's building. This +- works as in lxml.builder now. +- +- * LP#1228881: ``repr(XSLTAccessControl)`` failed in Python 3. +- +- * Raise ``ValueError`` when trying to append an Element to itself or +- to one of its own descendants, instead of running into an infinite +- loop. +- +- * LP#1206077: htmldiff discarded whitespace from the output. +- +- * Compressed plain-text serialisation to file-like objects was broken. +- +- * lxml.html.formfill: Fix textarea form filling. +- The textarea used to be cleared before the new content was set, +- which removed the name attribute. +- +- Other changes +- ------------- +- +- * Some basic API classes use freelists internally for faster +- instantiation. This can speed up some ``iterparse()`` scenarios, +- for example. +- +- * ``iterparse()`` was rewritten to use the new ``*PullParser`` +- classes internally instead of being a parser itself. + +* Mon Nov 11 2013 Jeffrey Ollie - 3.2.4-1 +- 3.2.4 (2013-11-07) +- ================== +- +- Bugs fixed +- ---------- +- +- * Memory leak when creating an XPath evaluator in a thread. +- +- * LP#1228881: ``repr(XSLTAccessControl)`` failed in Python 3. +- +- * Raise ``ValueError`` when trying to append an Element to itself or +- to one of its own descendants. +- +- * LP#1206077: htmldiff discarded whitespace from the output. +- +- * Compressed plain-text serialisation to file-like objects was broken. + +* Wed Sep 18 2013 Jeffrey Ollie - 3.2.3-2 +- Add requirement for on python-cssselect for the python2 version + +* Sun Jul 28 2013 Jeffrey Ollie - 3.2.3-1 +- and here's a version 3.2.3. The last release accidentally lost the ability +- to work on Python 2.4. There are no other changes over 3.2.2. +- +- 3.2.2 (2013-07-28) +- ================== +- +- Features added +- -------------- +- +- Bugs fixed +- ---------- +- +- * LP#1185701: spurious XMLSyntaxError after finishing iterparse(). +- +- * Crash in lxml.objectify during xsi annotation. +- +- Other changes +- ------------- +- +- * Return values of user provided element class lookup methods are now +- validated against the type of the XML node they represent to prevent +- API class mismatches. + +* Sun May 12 2013 Jeffrey Ollie - 3.2.1-1 +- 3.2.1 (2013-05-11) +- ================== +- +- Features added +- -------------- +- +- * The methods ``apply_templates()`` and ``process_children()`` of XSLT +- extension elements have gained two new boolean options ``elements_only`` +- and ``remove_blank_text`` that discard either all strings or +- whitespace-only strings from the result list. +- +- Bugs fixed +- ---------- +- +- * When moving Elements to another tree, the namespace cleanup mechanism +- no longer drops namespace prefixes from attributes for which it finds +- a default namespace declaration, to prevent them from appearing as +- unnamespaced attributes after serialisation. +- +- * Returning non-type objects from a custom class lookup method could lead +- to a crash. +- +- * Instantiating and using subtypes of Comments and ProcessingInstructions +- crashed. + +* Fri May 10 2013 Jeffrey Ollie - 3.2.0-1 +- 3.2.0 (2013-04-28) +- ================== +- +- Features added +- -------------- +- +- Bugs fixed +- ---------- +- +- * LP#690319: Leading whitespace could change the behaviour of the string +- parsing functions in ``lxml.html``. +- +- * LP#599318: The string parsing functions in ``lxml.html`` are more robust +- in the face of uncommon HTML content like framesets or missing body tags. +- Patch by Stefan Seelmann. +- +- * LP#712941: I/O errors while trying to access files with paths that +- contain non-ASCII characters could raise ``UnicodeDecodeError`` instead +- of properly reporting the ``IOError``. +- +- * LP#673205: Parsing from in-memory strings disabled network access in the +- default parser and made subsequent attempts to parse from a URL fail. +- +- * LP#971754: lxml.html.clean appends 'nofollow' to 'rel' attributes instead +- of overwriting the current value. +- +- * LP#715687: lxml.html.clean no longer discards scripts that are explicitly +- allowed by the user provided whitelist. Patch by Christine Koppelt. +- +- 3.1.2 (2013-04-12) +- ================== +- +- Bugs fixed +- ---------- +- +- * LP#1136509: Passing attributes through the namespace-unaware API of +- the sax bridge (i.e. the ``handler.startElement()`` method) failed +- with a ``TypeError``. Patch by Mike Bayer. +- +- * LP#1123074: Fix serialisation error in XSLT output when converting +- the result tree to a Unicode string. +- +- * GH#105: Replace illegal usage of ``xmlBufLength()`` in libxml2 2.9.0 +- by properly exported API function ``xmlBufUse()``. +- +- 3.1.1 (2013-03-29) +- ================== +- +- Features added +- -------------- +- +- Bugs fixed +- ---------- +- +- * LP#1160386: Write access to ``lxml.html.FormElement.fields`` raised +- an AttributeError in Py3. +- +- * Illegal memory access during cleanup in incremental xmlfile writer. +- +- Other changes +- ------------- +- +- * The externally useless class ``lxml.etree._BaseParser`` was removed +- from the module dict. + +* Fri Mar 8 2013 Jeffrey Ollie - 3.1.0-1 +- 3.1.0 (2013-02-10) +- ================== +- +- Features added +- -------------- +- +- * GH#89: lxml.html.clean allows overriding the set of attributes that it +- considers 'safe'. Patch by Francis Devereux. +- +- Bugs fixed +- ---------- +- +- * LP#1104370: ``copy.copy(el.attrib)`` raised an exception. It now returns +- a copy of the attributes as a plain Python dict. +- +- * GH#95: When used with namespace prefixes, the ``el.find*()`` methods +- always used the first namespace mapping that was provided for each +- path expression instead of using the one that was actually passed +- in for the current run. +- +- * LP#1092521, GH#91: Fix undefined C symbol in Python runtimes compiled +- without threading support. Patch by Ulrich Seidl. +- +- Other changes +- ------------- +- +- +- 3.1beta1 (2012-12-21) +- ===================== +- +- Features added +- -------------- +- +- * New build-time option ``--with-unicode-strings`` for Python 2 that +- makes the API always return Unicode strings for names and text +- instead of byte strings for plain ASCII content. +- +- * New incremental XML file writing API ``etree.xmlfile()``. +- +- * E factory in lxml.objectify is callable to simplify the creation of +- tags with non-identifier names without having to resort to getattr(). +- +- Bugs fixed +- ---------- +- +- * When starting from a non-namespaced element in lxml.objectify, searching +- for a child without explicitly specifying a namespace incorrectly found +- namespaced elements with the requested local name, instead of restricting +- the search to non-namespaced children. +- +- * GH#85: Deprecation warnings were fixed for Python 3.x. +- +- * GH#33: lxml.html.fromstring() failed to accept bytes input in Py3. +- +- * LP#1080792: Static build of libxml2 2.9.0 failed due to missing file. +- +- Other changes +- ------------- +- +- * The externally useless class ``_ObjectifyElementMakerCaller`` was +- removed from the module API of lxml.objectify. +- +- * LP#1075622: lxml.builder is faster for adding text to elements with +- many children. Patch by Anders Hammarquist. + +* Thu Feb 14 2013 Fedora Release Engineering - 3.0.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Mon Oct 15 2012 Jeffrey Ollie - 3.0.1-1 +- 3.0.1 (2012-10-14) +- Bugs fixed +- +- * LP#1065924: Element proxies could disappear during garbage collection +- in PyPy without proper cleanup. +- * GH#71: Failure to work with libxml2 2.6.x. +- * LP#1065139: static MacOS-X build failed in Py3. + +* Wed Oct 10 2012 Jeffrey Ollie - 3.0-1 +- 3.0 (2012-10-08) +- ================ +- +- Features added +- -------------- +- +- Bugs fixed +- ---------- +- +- * End-of-file handling was incorrect in iterparse() when reading from +- a low-level C file stream and failed in libxml2 2.9.0 due to its +- improved consistency checks. +- +- Other changes +- ------------- +- +- * The build no longer uses Cython by default unless the generated C files +- are missing. To use Cython, pass the option "--with-cython". To ignore +- the fatal build error when Cython is required but not available (e.g. to +- run special setup.py commands that do not actually run a build), pass +- "--without-cython". +- +- +- 3.0beta1 (2012-09-26) +- ===================== +- +- Features added +- -------------- +- +- * Python level access to (optional) libxml2 memory debugging features +- to simplify debugging of memory leaks etc. +- +- Bugs fixed +- ---------- +- +- * Fix a memory leak in XPath by switching to Cython 0.17.1. +- +- * Some tests were adapted to work with PyPy. +- +- Other changes +- ------------- +- +- * The code was adapted to work with the upcoming libxml2 2.9.0 release. +- +- +- 3.0alpha2 (2012-08-23) +- ====================== +- +- Features added +- -------------- +- +- * The .iter() method of elements now accepts tag arguments like "{*}name" +- to search for elements with a given local name in any namespace. With +- this addition, all combinations of wildcards now work as expected: +- "{ns}name", "{}name", "{*}name", "{ns}*", "{}*" and "{*}*". Note that +- "name" is equivalent to "{}name", but "*" is "{*}*". The same change +- applies to the .getiterator(), .itersiblings(), .iterancestors(), +- .iterdescendants(), .iterchildren() and .itertext() methods, the +- strip_attributes(), strip_elements() and strip_tags() functions as well +- as the iterparse() function. +- +- * C14N allows specifying the inclusive prefixes to be promoted to +- top-level during exclusive serialisation. +- +- Bugs fixed +- ---------- +- +- * Passing long Unicode strings into the feed() parser interface failed to +- read the entire string. +- +- Other changes +- ------------- +- +- +- 3.0alpha1 (2012-07-31) +- ====================== +- +- Features added +- -------------- +- +- * Initial support for building in PyPy (through cpyext). +- +- * DTD objects gained an API that allows read access to their +- declarations. +- +- * xpathgrep.py gained support for parsing line-by-line (e.g. +- from grep output) and for surrounding the output with a new root +- tag. +- +- * E-factory in lxml.builder accepts subtypes of known data +- types (such as string subtypes) when building elements around them. +- +- * Tree iteration and iterparse() with a selective tag +- argument supports passing a set of tags. Tree nodes will be +- returned by the iterators if they match any of the tags. +- +- Bugs fixed +- ---------- +- +- * The .find*() methods in lxml.objectify no longer use XPath +- internally, which makes them faster in many cases (especially when +- short circuiting after a single or couple of elements) and fixes +- some behavioural differences compared to lxml.etree. Note that +- this means that they no longer support arbitrary XPath expressions +- but only the subset that the ElementPath language supports. +- The previous implementation was also redundant with the normal +- XPath support, which can be used as a replacement. +- +- * el.find('*') could accidentally return a comment or processing +- instruction that happened to be in the wrong spot. (Same for the +- other .find*() methods.) +- +- * The error logging is less intrusive and avoids a global setup where +- possible. +- +- * Fixed undefined names in html5lib parser. +- +- * xpathgrep.py did not work in Python 3. +- +- * Element.attrib.update() did not accept an attrib of +- another Element as parameter. +- +- * For subtypes of ElementBase that make the .text or .tail +- properties immutable (as in objectify, for example), inserting text +- when creating Elements through the E-Factory feature of the class +- constructor would fail with an exception, stating that the text +- cannot be modified. +- +- Other changes +- -------------- +- +- * The code base was overhauled to properly use 'const' where the API +- of libxml2 and libxslt requests it. This also has an impact on the +- public C-API of lxml itself, as defined in etreepublic.pxd, as +- well as the provided declarations in the lxml/includes/ directory. +- Code that uses these declarations may have to be adapted. On the +- plus side, this fixes several C compiler warnings, also for user +- code, thus making it easier to spot real problems again. +- +- * The functionality of "lxml.cssselect" was moved into a separate PyPI +- package called "cssselect". To continue using it, you must install +- that package separately. The "lxml.cssselect" module is still +- available and provides the same interface, provided the "cssselect" +- package can be imported at runtime. +- +- * Element attributes passed in as an attrib dict or as keyword +- arguments are now sorted by (namespaced) name before being created +- to make their order predictable for serialisation and iteration. +- Note that adding or deleting attributes afterwards does not take +- that order into account, i.e. setting a new attribute appends it +- after the existing ones. +- +- * Several classes that are for internal use only were removed +- from the lxml.etree module dict: +- _InputDocument, _ResolverRegistry, _ResolverContext, _BaseContext, +- _ExsltRegExp, _IterparseContext, _TempStore, _ExceptionContext, +- __ContentOnlyElement, _AttribIterator, _NamespaceRegistry, +- _ClassNamespaceRegistry, _FunctionNamespaceRegistry, +- _XPathFunctionNamespaceRegistry, _ParserDictionaryContext, +- _FileReaderContext, _ParserContext, _PythonSaxParserTarget, +- _TargetParserContext, _ReadOnlyProxy, _ReadOnlyPIProxy, +- _ReadOnlyEntityProxy, _ReadOnlyElementProxy, _OpaqueNodeWrapper, +- _OpaqueDocumentWrapper, _ModifyContentOnlyProxy, +- _ModifyContentOnlyPIProxy, _ModifyContentOnlyEntityProxy, +- _AppendOnlyElementProxy, _SaxParserContext, _FilelikeWriter, +- _ParserSchemaValidationContext, _XPathContext, +- _XSLTResolverContext, _XSLTContext, _XSLTQuotedStringParam +- +- * Several internal classes can no longer be inherited from: +- _InputDocument, _ResolverRegistry, _ExsltRegExp, _ElementUnicodeResult, +- _IterparseContext, _TempStore, _AttribIterator, _ClassNamespaceRegistry, +- _XPathFunctionNamespaceRegistry, _ParserDictionaryContext, +- _FileReaderContext, _PythonSaxParserTarget, _TargetParserContext, +- _ReadOnlyPIProxy, _ReadOnlyEntityProxy, _OpaqueDocumentWrapper, +- _ModifyContentOnlyPIProxy, _ModifyContentOnlyEntityProxy, +- _AppendOnlyElementProxy, _FilelikeWriter, _ParserSchemaValidationContext, +- _XPathContext, _XSLTResolverContext, _XSLTContext, +- _XSLTQuotedStringParam, _XSLTResultTree, _XSLTProcessingInstruction + +* Thu Sep 27 2012 Jeffrey Ollie - 2.3.5-1 +- Bugs fixed +- +- * Crash when merging text nodes in element.remove(). +- * Crash in sax/target parser when reporting empty doctype. + +* Thu Sep 27 2012 Jeffrey Ollie - 2.3.4-1 +- Bugs fixed +- +- * Crash when building an nsmap (Element property) with empty namespace +- URIs. +- * Crash due to race condition when errors (or user messages) occur during +- threaded XSLT processing (or compilation). +- * XSLT stylesheet compilation could ignore compilation errors. + +* Sat Aug 04 2012 David Malcolm - 2.3.3-4 +- rebuild for https://fedoraproject.org/wiki/Features/Python_3.3 + +* Fri Aug 3 2012 David Malcolm - 2.3.3-3 +- remove rhel logic from with_python3 conditional + +* Sat Jul 21 2012 Fedora Release Engineering - 2.3.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Thu Jan 5 2012 Jeffrey C. Ollie - 2.3.3-1 +- 2.3.3 (2012-01-04) +- Features added +- +- * lxml.html.tostring() gained new serialisation options with_tail and +- doctype. +- +- Bugs fixed +- +- * Fixed a crash when using iterparse() for HTML parsing and requesting +- start events. +- * Fixed parsing of more selectors in cssselect. Whitespace before pseudo- +- elements and pseudo-classes is significant as it is a descendant +- combinator. "E :pseudo" should parse the same as "E *:pseudo", not +- "E:pseudo". Patch by Simon Sapin. +- * lxml.html.diff no longer raises an exception when hitting 'img' tags +- without 'src' attribute. + +* Mon Nov 14 2011 Jeffrey C. Ollie - 2.3.2-1 +- 2.3.2 (2011-11-11) +- Features added +- +- * lxml.objectify.deannotate() has a new boolean option +- cleanup_namespaces to remove the objectify namespace declarations +- (and generally clean up the namespace declarations) after removing +- the type annotations. +- * lxml.objectify gained its own SubElement() function as a copy of +- etree.SubElement to avoid an otherwise redundant import of +- lxml.etree on the user side. +- +- Bugs fixed +- +- * Fixed the "descendant" bug in cssselect a second time (after a first +- fix in lxml 2.3.1). The previous change resulted in a serious +- performance regression for the XPath based evaluation of the +- translated expression. Note that this breaks the usage of some +- of the generated XPath expressions as XSLT location paths that +- previously worked in 2.3.1. +- * Fixed parsing of some selectors in cssselect. Whitespace after +- combinators ">", "+" and "~" is now correctly ignored. Previously +- it was parsed as a descendant combinator. For example, "div> .foo" +- was parsed the same as "div>* .foo" instead of "div>.foo". Patch by +- Simon Sapin. + +* Sun Sep 25 2011 Jeffrey C. Ollie - 2.3.1-1 +- Features added +- -------------- +- +- * New option kill_tags in lxml.html.clean to remove specific +- tags and their content (i.e. their whole subtree). +- +- * pi.get() and pi.attrib on processing instructions to parse +- pseudo-attributes from the text content of processing instructions. +- +- * lxml.get_include() returns a list of include paths that can be +- used to compile external C code against lxml.etree. This is +- specifically required for statically linked lxml builds when code +- needs to compile against the exact same header file versions as lxml +- itself. +- +- * Resolver.resolve_file() takes an additional option +- close_file that configures if the file(-like) object will be +- closed after reading or not. By default, the file will be closed, +- as the user is not expected to keep a reference to it. +- +- Bugs fixed +- ---------- +- +- * HTML cleaning didn't remove 'data:' links. +- +- * The html5lib parser integration now uses the 'official' +- implementation in html5lib itself, which makes it work with newer +- releases of the library. +- +- * In lxml.sax, endElementNS() could incorrectly reject a plain +- tag name when the corresponding start event inferred the same plain +- tag name to be in the default namespace. +- +- * When an open file-like object is passed into parse() or +- iterparse(), the parser will no longer close it after use. This +- reverts a change in lxml 2.3 where all files would be closed. It is +- the users responsibility to properly close the file(-like) object, +- also in error cases. +- +- * Assertion error in lxml.html.cleaner when discarding top-level elements. +- +- * In lxml.cssselect, use the xpath 'A//B' (short for +- 'A/descendant-or-self::node()/B') instead of 'A/descendant::B' for the +- css descendant selector ('A B'). This makes a few edge cases to be +- consistent with the selector behavior in WebKit and Firefox, and makes +- more css expressions valid location paths (for use in xsl:template +- match). +- +- * In lxml.html, non-selected