Open PhilippWendler opened 2 years ago
Thanks for the report! I'll send a PR to typeshed.
Ah, nevermind, it looks like TEXT_NODE is indeed defined in the parent xml.dom.Node class. So this is a pytype bug of some sort in pyi lookup.
@rchen152 wrote:
Ah, nevermind, it looks like TEXT_NODE is indeed defined in the parent xml.dom.Node class. So this is a pytype bug of some sort in pyi lookup.
@rchen152 Can you fix it? I see this error aborting pytype-2024.1.24 installed on Python 3.10.12 of Ubuntu 22.04 with the same error:
pytype scripts/examples/python/provision.py
Computing dependencies
Analyzing 1 sources with 2 local dependencies
ninja: Entering directory `.pytype'
[2/2] check provision
FAILED: /home/bkaindl/git/github/review/5427/xen-api/.pytype/pyi/provision.pyi
/usr/bin/python3 -m pytype.single --disable import-error,ignored-abstractmethod,ignored-metaclass --imports_info /home/bkaindl/git/github/review/5427/xen-api/.pytype/imports/provision.imports --module-name provision --platform linux -V 3.10 -o /home/bkaindl/git/github/review/5427/xen-api/.pytype/pyi/provision.pyi --analyze-annotated --nofail --quick /home/bkaindl/git/github/review/5427/xen-api/scripts/examples/python/provision.py
File "/home/bkaindl/git/github/review/5427/xen-api/scripts/examples/python/provision.py", line 65, in parseProvisionSpec: Couldn't import pyi for 'xml.dom.minidom' [pyi-error]
No Node.TEXT_NODE in module xml.dom.minidom, referenced from 'xml.dom.expatbuilder'
File "/home/bkaindl/git/github/review/5427/xen-api/scripts/examples/python/provision.py", line 77, in printProvisionSpec: Couldn't import pyi for 'xml.dom.minidom' [pyi-error]
No Node.TEXT_NODE in module xml.dom.minidom, referenced from 'xml.dom.expatbuilder'
For more details, see https://google.github.io/pytype/errors.html#pyi-error
ninja: build stopped: subcommand failed.
Leaving directory '.pytype'
Disabled pyi-error
now...
When using the
xml.dom.minidom
API, pytype 2022.02.17 fails. With 2022.2.8 this still worked.Minimal example:
Output from pytype:
xml.dom.minidom.Node.TEXT_NODE
exists in the stdlib, it is an int constant and referred to here. However, it is not inminidom.pyi
.I guess this is caused by the recent typeshed update, which brought https://github.com/python/typeshed/commit/6b2218846ccc368059142640b469ee80169050c3.
Tested on Python 3.7 and Python 3.9.