Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34k
Open
Description
Bug report
Bug description:
This code runs fine on Python 3.13.7:
importxml.etree.ElementTreeasETx=ET.Element("x")ET.SubElement(x,0,parent="0")
However, Pyrightcorrectly detects a type error in theSubElement call.SubElement has this Python signature:
defSubElement(parent,tag,attrib={},**extra):
Theparent parameter has already been assigned, so thisshould fail. I believe the fact that it doesn't is because it's actually using a C implementation, and the C implementation hasthis type signature:
def SubElement(parent, tag, /, attrib={}, **extra):Whichdoes allow specifyingparent="0".
So I think the solution is just to add that/ into the Python code.
CPython versions tested on:
3.13
Operating systems tested on:
Linux