GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — ElementTree: empty path makes find()/findall()/findtext() raise TypeError · Issue #161807 · python/cpython Open Labels extension-modulesC modules in the Modules dirC modules in the Modules dirstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-XMLtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error DescriptionBug reportBug descriptionPassing an empty path to With the C accelerator: import xml.etree.ElementTree as ET from xml.etree import ElementPath root = ET.Element("root") root.findall("") # [] root.findall("", namespaces={}) # TypeError: 'NoneType' object is not iterable ElementPath.findall(root, "") # TypeError: 'NoneType' object is not iterable With the pure-Python implementation (the fallback used when import sys sys.modules["_elementtree"] = None import xml.etree.ElementTree as ET root = ET.Element("root") root.findall("") # TypeError: 'NoneType' object is not iterable root.find("") # TypeError: 'NoneType' object is not an iterator root.findtext("", default="D") # TypeError: 'NoneType' object is not an iterator Cause. try: token = next() except StopIteration: return So it returns Expected. The same result in both implementations, with or without I'm happy to open a PR. CPython versions tested on:CPython main branch, 3.14, 3.13, 3.12 Operating systems tested on:Linux Activity
MetadataMetadataAssigneesLabelsextension-modulesC modules in the Modules dirC modules in the Modules dirstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-XMLtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error ProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |