From 413614aa8357d1740eacf53ae3fa1d32b14b4de7 Mon Sep 17 00:00:00 2001 From: hatal175 Date: Fri, 9 Apr 2021 03:43:51 +0300 Subject: [PATCH] xml stubtest exceptions (#5161) * Explaining xml stubtest exceptions * Fix 3.6/3.7 ExternalEntityParserCreate * Fix typos and formatting * Missing return type * Reverting ExternalEntityParserCreate change to see error * Remove unused sys import * Readd ExternalEntityParserCreate with explanations --- stdlib/xml/etree/ElementPath.pyi | 2 +- stdlib/xml/sax/xmlreader.pyi | 1 - tests/stubtest_whitelists/py36.txt | 4 ++-- tests/stubtest_whitelists/py37.txt | 4 ++-- tests/stubtest_whitelists/py38.txt | 4 ++-- tests/stubtest_whitelists/py39.txt | 4 ++-- tests/stubtest_whitelists/py3_common.txt | 2 -- 7 files changed, 9 insertions(+), 12 deletions(-) diff --git a/stdlib/xml/etree/ElementPath.pyi b/stdlib/xml/etree/ElementPath.pyi index d4a85957d..de49ffcf1 100644 --- a/stdlib/xml/etree/ElementPath.pyi +++ b/stdlib/xml/etree/ElementPath.pyi @@ -19,7 +19,7 @@ def prepare_predicate(next: _next, token: _token) -> _callback: ... ops: Dict[str, Callable[[_next, _token], _callback]] class _SelectorContext: - parent_map: Dict[Element, Element] + parent_map: Optional[Dict[Element, Element]] root: Element def __init__(self, root: Element) -> None: ... diff --git a/stdlib/xml/sax/xmlreader.pyi b/stdlib/xml/sax/xmlreader.pyi index de0d1169a..9dd6b75fd 100644 --- a/stdlib/xml/sax/xmlreader.pyi +++ b/stdlib/xml/sax/xmlreader.pyi @@ -57,7 +57,6 @@ class AttributesImpl: def __len__(self): ... def __getitem__(self, name): ... def keys(self): ... - def has_key(self, name): ... def __contains__(self, name): ... def get(self, name, alternative=...): ... def copy(self): ... diff --git a/tests/stubtest_whitelists/py36.txt b/tests/stubtest_whitelists/py36.txt index 994fda41e..df9ae916a 100644 --- a/tests/stubtest_whitelists/py36.txt +++ b/tests/stubtest_whitelists/py36.txt @@ -36,7 +36,7 @@ multiprocessing.shared_memory nntplib._NNTPBase.starttls os.utime plistlib.Dict.__init__ -pyexpat.XMLParserType.ExternalEntityParserCreate +pyexpat.XMLParserType.ExternalEntityParserCreate # C signature is wrong - function gets only positional args random.Random.randrange # missing undocumented arg _int random.randrange # missing undocumented arg _int secrets.SystemRandom.getstate @@ -72,7 +72,7 @@ uuid.UUID.int webbrowser.Opera.raise_opts xml.etree.ElementTree.TreeBuilder.start # Discrepancy between Python and C modules, fixed in bpo-39495 xml.etree.cElementTree.TreeBuilder.start # bpo-39495 -xml.parsers.expat.XMLParserType.ExternalEntityParserCreate +xml.parsers.expat.XMLParserType.ExternalEntityParserCreate # C signature is wrong - function gets only positional args # These enums derive from (int, IntEnum) or (str, Enum). See comment in py3_common.txt enum.IntFlag.__new__ re.RegexFlag.__new__ diff --git a/tests/stubtest_whitelists/py37.txt b/tests/stubtest_whitelists/py37.txt index 5250a29b9..68493f58e 100644 --- a/tests/stubtest_whitelists/py37.txt +++ b/tests/stubtest_whitelists/py37.txt @@ -45,7 +45,7 @@ macurl2path # removed in 3.7 multiprocessing.shared_memory nntplib._NNTPBase.starttls os.utime -pyexpat.XMLParserType.ExternalEntityParserCreate +pyexpat.XMLParserType.ExternalEntityParserCreate # C signature is wrong - function gets only positional args queue.SimpleQueue.__init__ random.Random.randrange # missing undocumented arg _int random.randrange # missing undocumented arg _int @@ -72,7 +72,7 @@ uuid.getnode # undocumented, unused parameter getters that was later removed webbrowser.Opera.raise_opts xml.etree.ElementTree.TreeBuilder.start # Discrepancy between Python and C modules, fixed in bpo-39495 xml.etree.cElementTree.TreeBuilder.start # bpo-39495 -xml.parsers.expat.XMLParserType.ExternalEntityParserCreate +xml.parsers.expat.XMLParserType.ExternalEntityParserCreate # C signature is wrong - function gets only positional args # These enums derive from (int, IntEnum) or (str, Enum). See comment in py3_common.txt enum.IntFlag.__new__ pstats.SortKey.__new__ diff --git a/tests/stubtest_whitelists/py38.txt b/tests/stubtest_whitelists/py38.txt index 804345b9b..d4f516045 100644 --- a/tests/stubtest_whitelists/py38.txt +++ b/tests/stubtest_whitelists/py38.txt @@ -99,9 +99,9 @@ uuid.getnode # undocumented, unused parameter getters that was later removed weakref.WeakValueDictionary.update webbrowser.Opera.raise_opts xml.etree.ElementTree.TreeBuilder.start # Discrepancy between Python and C modules, fixed in bpo-39495 -xml.etree.ElementTree.XMLParser.__init__ +xml.etree.ElementTree.XMLParser.__init__ # Defined in C so has general signature xml.etree.cElementTree.TreeBuilder.start # bpo-39495 -xml.etree.cElementTree.XMLParser.__init__ +xml.etree.cElementTree.XMLParser.__init__ # Defined in C so has general signature zipfile.Path.open # These enums derive from (int, IntEnum) or (str, Enum). See comment in py3_common.txt enum.IntFlag.__new__ diff --git a/tests/stubtest_whitelists/py39.txt b/tests/stubtest_whitelists/py39.txt index f45ac46c6..48775962a 100644 --- a/tests/stubtest_whitelists/py39.txt +++ b/tests/stubtest_whitelists/py39.txt @@ -130,8 +130,8 @@ typing._TypedDict.values unittest.doModuleCleanups weakref.WeakValueDictionary.update webbrowser.Opera.raise_opts -xml.etree.ElementTree.XMLParser.__init__ -xml.etree.cElementTree.XMLParser.__init__ +xml.etree.ElementTree.XMLParser.__init__ # Defined in C so has general signature +xml.etree.cElementTree.XMLParser.__init__ # Defined in C so has general signature # positional-only complaints builtins.bytearray.pop diff --git a/tests/stubtest_whitelists/py3_common.txt b/tests/stubtest_whitelists/py3_common.txt index 1c1ff9747..99e8b0d0d 100644 --- a/tests/stubtest_whitelists/py3_common.txt +++ b/tests/stubtest_whitelists/py3_common.txt @@ -413,8 +413,6 @@ webbrowser.UnixBrowser.remote_action webbrowser.UnixBrowser.remote_action_newtab webbrowser.UnixBrowser.remote_action_newwin wsgiref.types # Doesn't exist, see comments in file -xml.etree.ElementPath._SelectorContext.parent_map -xml.sax.xmlreader.AttributesImpl.has_key zipfile.ZipExtFile.read zipfile.ZipExtFile.readline zlib.compressobj