Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add warning about the global set_element_class_lookup #341

Merged
merged 3 commits into from
Mar 13, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/api/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
autodoc_default_options = {
'ignore-module-all': True,
'private-members': True,
'inherited-members': True,
}

autodoc_member_order = 'groupwise'
Expand Down
10 changes: 10 additions & 0 deletions src/lxml/classlookup.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,16 @@ def set_element_class_lookup(ElementClassLookup lookup = None):
u"""set_element_class_lookup(lookup = None)

Set the global default element class lookup method.
scoder marked this conversation as resolved.
Show resolved Hide resolved

.. warning::

Setting the default element class to something other than a
:class:`ParserBasedElementClassLookup` will prevent
:meth:`~lxml.etree.XMLParser.set_element_class_lookup` from working.

Amongst other issues, this will break :mod:`lxml.html` and
:mod:`lxml.objectify`'s extensions as they rely on lookups configured
on their respective parsers.
scoder marked this conversation as resolved.
Show resolved Hide resolved
"""
if lookup is None or lookup._lookup_function is NULL:
_setElementClassLookupFunction(NULL, None)
Expand Down