Title: gh-144846: make Element tag positional-only by NekoAsakura · Pull Request #144876 · python/cpython · GitHub
Open Graph Title: gh-144846: make Element tag positional-only by NekoAsakura · Pull Request #144876 · python/cpython
X Title: gh-144846: make Element tag positional-only by NekoAsakura · Pull Request #144876 · python/cpython
Description: Make tag positional-only in xml.etree.ElementTree.Element.__init__ to match the C accelerator. The C implementation (_elementtree.Element) uses PyArg_ParseTuple, which inherently makes tag positional-only. The Python fallback used def __init__(self, tag, attrib={}, **extra): which allowed tag as a keyword argument. This inconsistency meant Element(tag="foo") worked only when the C accelerator was unavailable. Same pattern as gh-144270 (SubElement). Fix: add / after tag → def __init__(self, tag, /, attrib={}, **extra): Changes Lib/xml/etree/ElementTree.py: add / to Element.__init__ signature Lib/test/test_xml_etree.py: add test_element_init covering positional-only enforcement, keyword attrib, and kwargs-as-XML-attributes parity Doc/library/xml.etree.elementtree.rst: update signature and add versionchanged:: 3.15 Issue: gh-144846 📚 Documentation preview 📚: https://cpython-previews--144876.org.readthedocs.build/
Open Graph Description: Make tag positional-only in xml.etree.ElementTree.Element.__init__ to match the C accelerator. The C implementation (_elementtree.Element) uses PyArg_ParseTuple, which inherently makes tag position...
X Description: Make tag positional-only in xml.etree.ElementTree.Element.__init__ to match the C accelerator. The C implementation (_elementtree.Element) uses PyArg_ParseTuple, which inherently makes tag position...
Opengraph URL: https://github.com/python/cpython/pull/144876
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:ccfdfc4e-d19f-ec69-c510-8a2f16fa042d |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 8238:1CFEED:108806E:15EB0B8:6A51C544 |
| html-safe-nonce | e2657cd8a210399e7ead55339e9d85bc9f4fc953e7f8d7eef4638b55dfcfc231 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MjM4OjFDRkVFRDoxMDg4MDZFOjE1RUIwQjg6NkE1MUM1NDQiLCJ2aXNpdG9yX2lkIjoiNjgyNjM1NDc1NDk5NTczMzgyOCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d9cb7a806f5b7a4ca16a4d3945797409d69d2c0962d530b775e8d93399f7281e |
| hovercard-subject-tag | pull_request:3289821170 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/python/cpython/pull/144876/files |
| twitter:image | https://avatars.githubusercontent.com/u/72689291?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/72689291?s=400&v=4 |
| og:image:alt | Make tag positional-only in xml.etree.ElementTree.Element.__init__ to match the C accelerator. The C implementation (_elementtree.Element) uses PyArg_ParseTuple, which inherently makes tag position... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7aed05249554b889eb33d002851a973eebcc7e91 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width