Skip to content

Releases: lxml/lxml

lxml-6.1.0

17 Apr 21:16

Choose a tag to compare

6.1.0 (2026-04-17)

==================

This release fixes a possible external entity injection (XXE) vulnerability in
``iterparse()`` and the ``ETCompatXMLParser``.

Features added
--------------

* GH#486: The HTML ARIA accessibility attributes were added to the set of safe attributes
  in ``lxml.html.defs``.  This allows ``lxml_html_clean`` to pass them through.
  Patch by oomsveta.

* The default chunk size for reading from file-likes in ``iterparse()`` is now configurable
  with a new ``chunk_size`` argument.

Bugs fixed
----------

* LP#2146291: The ``resolve_entities`` option was still set to ``True`` for
  ``iterparse`` and ``ETCompatXMLParser``, allowing for external entity injection (XXE)
  when using these parsers without setting this option explicitly.
  The default was now changed to ``'internal'`` only (as for the normal XML and HTML parsers
  since lxml 5.0).
  Issue found by Sihao Qiu as CVE-2026-41066.

lxml-6.0.4

12 Apr 15:59

Choose a tag to compare

6.0.4 (2026-04-12)

==================

Bugs fixed
----------

* LP#2148019: Spurious MemoryError during namespace cleanup.

lxml-6.0.3

09 Apr 13:14

Choose a tag to compare

6.0.3 (2026-04-09)

==================

Bugs fixed
----------

* Several out of memory error cases now raise ``MemoryError`` that were not handled before.

* Slicing with large step values (outside of ``+/- sys.maxsize``) could trigger undefined C behaviour.

* LP#2125399: Some failing tests were fixed or disabled in PyPy.

* LP#2138421: Memory leak in error cases when setting the ``public_id`` or ``system_url`` of a document.

* Memory leak in case of a memory allocation failure when copying document subtrees.

* When mapping an XPath result to Python failed, the result memory could leak.

* When preparing an XSLT transform failed, the XSLT parameter memory could leak.

Other changes
-------------

* Built using Cython 3.2.4.

* Binary wheels use zlib 1.3.2.

lxml-6.0.2

21 Sep 23:14

Choose a tag to compare

6.0.2 (2025-09-21)

==================

Bugs fixed
----------

* LP#2125278: Compilation with libxml2 2.15.0 failed.
  Original patch by Xi Ruoyao.

* Setting ``decompress=True`` in the parser had no effect in libxml2 2.15.

* Binary wheels on Linux and macOS use the library version libxml2 2.14.6.
  See https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.14.6

* Test failures in libxml2 2.15.0 were fixed.

Other changes
-------------

* Binary wheels for Py3.9-3.11 on the ``riscv64`` architecture were added.

* Error constants were updated to match libxml2 2.15.0.

* Built using Cython 3.1.4.

lxml-6.0.1

22 Aug 07:24

Choose a tag to compare

6.0.1 (2025-08-22)

==================

Bugs fixed
----------

* LP#2116333: ``lxml.sax._getNsTag()`` could fail with an exception on malformed input.

* GH#467: Some test adaptations were made for libxml2 2.15.
  Patch by Nick Wellnhofer.

* LP2119510, GH#473: A Python compatibility test was fixed for Python 3.14+.
  Patch by Lumír Balhar.

* GH#471: Wheels for "riscv64" on recent Python versions were added.
  Patch by ffgan.

* GH#469: The wheel build no longer requires the ``wheel`` package unconditionally.
  Patch by Miro Hrončok.

* Binary wheels use the library version libxml2 2.14.5.

* Windows binary wheels continue to use a security patched library version libxml2 2.11.9.

lxml-6.0.0

26 Jun 14:36

Choose a tag to compare

6.0.0 (2025-06-26)

==================

Features added
--------------

* GH#463: ``lxml.html.diff`` is faster and provides structurally better diffs.
  Original patch by Steven Fernandez.

* GH#405: The factories ``Element`` and ``ElementTree`` can now be used in type hints.

* GH#448: Parsing from ``memoryview`` and other buffers is supported to allow zero-copy parsing.

* GH#437: ``lxml.html.builder`` was missing several HTML5 tag names.
  Patch by Nick Tarleton.

* GH#458: ``CDATA`` can now be written into the incremental ``xmlfile()`` writer.
  Original patch by Lane Shaw.

* A new parser option ``decompress=False`` was added that controls the automatic
  input decompression when using libxml2 2.15.0 or later.  Disabling this option
  by default will effectively prevent decompression bombs when handling untrusted
  input.  Code that depends on automatic decompression must enable this option.
  Note that libxml2 2.15.0 was not released yet, so this option currently has no
  effect but can already be used.

* The set of compile time / runtime supported libxml2 feature names is available as
  ``etree.LIBXML_COMPILED_FEATURES`` and ``etree.LIBXML_FEATURES``.
  This currently includes
  ``catalog``, ``ftp``, ``html``, ``http``, ``iconv``, ``icu``,
  ``lzma``, ``regexp``, ``schematron``, ``xmlschema``, ``xpath``, ``zlib``.

Bugs fixed
----------

* GH#353: Predicates in ``.find*()`` could mishandle tag indices if a default namespace is provided.
  Original patch by Luise K.

* GH#272: The ``head`` and ``body`` properties of ``lxml.html`` elements failed if no such element
  was found.  They now return ``None`` instead.
  Original patch by FVolral.

* Tag names provided by code (API, not data) that are longer than ``INT_MAX``
  could be truncated or mishandled in other ways.

* ``.text_content()`` on ``lxml.html`` elements accidentally returned a "smart string"
  without additional information.  It now returns a plain string.

* LP#2109931: When building lxml with coverage reporting, it now disables the ``sys.monitoring``
  support due to the lack of support in https://github.com/nedbat/coveragepy/issues/1790

Other changes
-------------

* Support for Python < 3.8 was removed.

* Parsing directly from zlib (or lzma) compressed data is now considered an optional
  feature in lxml.  It may get removed from libxml2 at some point for security reasons
  (compression bombs) and is therefore no longer guaranteed to be available in lxml.

  As of this release, zlib support is still normally available in the binary wheels
  but may get disabled or removed in later (x.y.0) releases.  To test the availability,
  use ``"zlib" in etree.LIBXML_FEATURES``.

* The ``Schematron`` class is deprecated and will become non-functional in a future lxml version.
  The feature will soon be removed from libxml2 and stop being available.

* GH#438: Wheels include the ``arm7l`` target.

* GH#465: Windows wheels include the ``arm64`` target.
  Patch by Finn Womack.

* Binary wheels use the library versions libxml2 2.14.4 and libxslt 1.1.43.
  Note that this disables direct HTTP and FTP support for parsing from URLs.
  Use Python URL request tools instead (which usually also support HTTPS).
  To test the availability, use ``"http" in etree.LIBXML_FEATURES``.

* Windows binary wheels use the library versions libxml2 2.11.9, libxslt 1.1.39 and libiconv 1.17.
  They are now based on VS-2022.

* Built using Cython 3.1.2.

* The debug methods ``MemDebug.dump()`` and ``MemDebug.show()`` were removed completely.
  libxml2 2.13.0 discarded this feature.

lxml-5.4.0

22 Apr 21:57

Choose a tag to compare

5.4.0 (2025-04-22)

Bugs fixed

  • LP#2107279: Binary wheels use libxml2 2.13.8 and libxslt 1.1.43 to resolve several CVEs.
    (Binary wheels for Windows continue to use a patched libxml2 2.11.9 and libxslt 1.1.39.)
    Issue found by Anatoly Katyushin, see https://bugs.launchpad.net/lxml/+bug/2107279

lxml-5.3.2

05 Apr 17:24

Choose a tag to compare

5.3.2 (2025-04-05)

==================

This release resolves CVE-2025-24928 as described in
https://gitlab.gnome.org/GNOME/libxml2/-/issues/847

Bugs fixed
----------

* Binary wheels use libxml2 2.12.10 and libxslt 1.1.42.

* Binary wheels for Windows use a patched libxml2 2.11.9 and libxslt 1.1.39.

lxml-5.3.1

09 Feb 22:28

Choose a tag to compare

5.3.1 (2025-02-09)

==================

Bugs fixed
----------

* GH#440: Some tests were adapted for libxml2 2.14.0.
  Patch by Nick Wellnhofer.

* LP#2097175: ``DTD(external_id="…")`` erroneously required a byte string as ID value.

* GH#450: ``iterparse()`` internally triggered the `DeprecationWarning`` added in lxml 5.3.0 when parsing HTML.

Other changes
-------------

* GH#442: Binary wheels for macOS no longer use the linker flag ``-flat_namespace``.

lxml-5.3.0

10 Aug 14:14

Choose a tag to compare

5.3.0 (2024-08-10)

==================

Features added
--------------

* GH#421: Nested ``CDATA`` sections are no longer rejected but split on output
  to represent ``]]>`` correctly.
  Patch by Gertjan Klein.

Bugs fixed
----------

* LP#2060160: Attribute values serialised differently in ``xmlfile.element()`` and ``xmlfile.write()``.

* LP#2058177: The ISO-Schematron implementation could fail on unknown prefixes.
  Patch by David Lakin.

Other changes
-------------

* LP#2067707: The ``strip_cdata`` option in ``HTMLParser()`` turned out to be useless and is now deprecated.

* Binary wheels use the library versions libxml2 2.12.9 and libxslt 1.1.42.

* Windows binary wheels use the library versions libxml2 2.11.8 and libxslt 1.1.39.

* Built with Cython 3.0.11.