diff options
author | RainerHausdorf <rainer.hausdorf@scale.eu> | 2019-08-18 12:35:15 +0200 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2019-08-18 12:35:15 +0200 |
commit | db8519a525b07d2501c8b6193b2224f52bc7d350 (patch) | |
tree | 956d8d89e44a218d7e76fc93cc0eb224d2f46031 /src/lxml/ElementInclude.py | |
parent | c9d4316b57c44b14998ddd3ca3a11859d935ee6f (diff) | |
download | python-lxml-db8519a525b07d2501c8b6193b2224f52bc7d350.tar.gz |
Fix false detection of recursive include (GH-286)
Fix false detection of recursive include.
In some cases ElementInclude does raise FatalIncludeError because of
recursive include detection. This is the case if the same file gets
included multiple times, but not recursive.
This is a fix for https://bugs.launchpad.net/lxml/+bug/1835708
Diffstat (limited to 'src/lxml/ElementInclude.py')
-rw-r--r-- | src/lxml/ElementInclude.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/lxml/ElementInclude.py b/src/lxml/ElementInclude.py index 10af448c..21884336 100644 --- a/src/lxml/ElementInclude.py +++ b/src/lxml/ElementInclude.py @@ -202,13 +202,12 @@ def _include(elem, loader=None, base_url=None, if max_depth == 0: raise LimitedRecursiveIncludeError( "maximum xinclude depth reached when including file %s" % href) - _parent_hrefs.add(href) node = load_include(href, parse, parser=parser) if node is None: raise FatalIncludeError( "cannot load %r as %r" % (href, parse) ) - node = _include(node, loader, href, max_depth - 1, _parent_hrefs) + node = _include(node, loader, href, max_depth - 1, {href} | _parent_hrefs) if e.tail: node.tail = (node.tail or "") + e.tail if parent is None: |