-
Notifications
You must be signed in to change notification settings - Fork 229
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
Union runtime check fails for xml.etree.cElementTree.Element #229
Comments
What error do you get? |
|
I don't think this is a Python 2 issue in particular, though -- it just so happens that only the Python 2 version of xml.etree.cElementTree.Element exhibits this problem. |
Probably a horrible idea...but what if |
Can you see if this is already fixed with the latest python2/typing.py from the githubcom/python/typing repo? |
I tried the file you mentioned and ran into the same issue. In the particular use I'm dealing with, I am able to get away with importing Element from ElementTree instead of cElementTree, which seems like a plausible workaround for this case. Though it is technically incorrect, since the returned object is not actually an instance of ElementTree.Element. The only way I can figure out how to access the actual type of the object returned by xml.etree.cElementTree.Element() is by calling type() on the returned object. |
Probably |
Under python 2, this fails at runtime, but it works for static type checking. Currently the best workaround seems to be to define T in a
if False:
block, which allows the static check to pass without causing runtime errors.The text was updated successfully, but these errors were encountered: