Lxml

Latest version: v5.3.1

Safety actively analyzes 706267 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 22 of 28

2.1beta1

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

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

* Error logging in Schematron (requires libxml2 2.6.32 or later).

* Parser option ``strip_cdata`` for normalising or keeping CDATA
sections. Defaults to ``True`` as before, thus replacing CDATA
sections by their text content.

* ``CDATA()`` factory to wrap string content as CDATA section.

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

* Resolving to a filename in custom resolvers didn't work.

* lxml did not honour libxslt's second error state "STOPPED", which
let some XSLT errors pass silently.

* Memory leak in Schematron with libxml2 >= 2.6.31.

* lxml.etree accepted non well-formed namespace prefix names.

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

* Major cleanup in internal ``moveNodeToDocument()`` function, which
takes care of namespace cleanup when moving elements between
different namespace contexts.

* New Elements created through the ``makeelement()`` method of an HTML
parser or through lxml.html now end up in a new HTML document
(doctype HTML 4.01 Transitional) instead of a generic XML document.
This mostly impacts the serialisation and the availability of a DTD
context.

2.1alpha1

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

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

* New event types 'comment' and 'pi' in ``iterparse()``.

* ``XSLTAccessControl`` instances have a property ``options`` that
returns a dict of access configuration options.

* Constant instances ``DENY_ALL`` and ``DENY_WRITE`` on
``XSLTAccessControl`` class.

* Extension elements for XSLT (experimental!)

* ``Element.base`` property returns the xml:base or HTML base URL of
an Element.

* ``docinfo.URL`` property is writable.

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

* Default encoding for plain text serialisation was different from
that of XML serialisation (UTF-8 instead of ASCII).

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

* Minor API speed-ups.

* The benchmark suite now uses tail text in the trees, which makes the
absolute numbers incomparable to previous results.

* Generating the HTML documentation now requires Pygments_, which is
used to enable syntax highlighting for the doctest examples.

.. _Pygments: http://pygments.org/

Most long-time deprecated functions and methods were removed:

- ``etree.clearErrorLog()``, use ``etree.clear_error_log()``

- ``etree.useGlobalPythonLog()``, use
``etree.use_global_python_log()``

- ``etree.ElementClassLookup.setFallback()``, use
``etree.ElementClassLookup.set_fallback()``

- ``etree.getDefaultParser()``, use ``etree.get_default_parser()``

- ``etree.setDefaultParser()``, use ``etree.set_default_parser()``

- ``etree.setElementClassLookup()``, use
``etree.set_element_class_lookup()``

Note that ``parser.setElementClassLookup()`` has not been removed
yet, although ``parser.set_element_class_lookup()`` should be used
instead.

- ``xpath_evaluator.registerNamespace()``, use
``xpath_evaluator.register_namespace()``

- ``xpath_evaluator.registerNamespaces()``, use
``xpath_evaluator.register_namespaces()``

- ``objectify.setPytypeAttributeTag``, use
``objectify.set_pytype_attribute_tag``

- ``objectify.setDefaultParser()``, use
``objectify.set_default_parser()``

2.0.11

Not secure
===================

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

* Crash when using an XPath evaluator in multiple threads.

2.0.10

Not secure
===================

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

* Ref-count leaks when lxml enters a try-except statement while an
outside exception lives in sys.exc_*(). This was due to a problem in
Cython, not lxml itself.

2.0.9

Not secure
==================

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

* Memory problem when passing documents between threads.

* Target parser did not honour the ``recover`` option and raised an
exception instead of calling ``.close()`` on the target.

2.0.8

Not secure
==================

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

* ``lxml.html.rewrite_links()`` strips links to work around documents
with whitespace in URL attributes.

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

* Crash when parsing XSLT stylesheets in a thread and using them in
another.

* CSS selector parser dropped remaining expression after a function
with parameters.

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

Page 22 of 28

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.