Title: Preserve valid prefix when extending Element by youknowdot · Pull Request #9594 · RustPython/RustPython · GitHub
Open Graph Title: Preserve valid prefix when extending Element by youknowdot · Pull Request #9594 · RustPython/RustPython
X Title: Preserve valid prefix when extending Element by youknowdot · Pull Request #9594 · RustPython/RustPython
Description: Summary Preserve earlier valid children when Element.extend encounters an invalid later item, as CPython does. Materialize the input before mutating the element, preserving existing behavior for self-extension and iterators that raise. Keep the one-lock bulk path for valid inputs. Verification and scope Compared with CPython 3.15.0 Modules/_elementtree.c. Reproduced the retained valid prefix and TypeError on the verified CPython 3.15.0 runtime with both list and iterator inputs. Independent source review covered materialization, valid-prefix ordering, lock and object lifetimes, concurrent type changes, and the successful-input fast path. Normal commit hooks, rustfmt and git diff --check passed. A file-level three-way merge with #9591 was clean. No local RustPython build, interpreter tests, workspace/C-API tests or clippy ran because the required coordinated native execution guard was unavailable. Hosted CI must validate the exact commit, including test_xml_etree; no tests were edited. Existing differences between iterable conversion and CPython's PySequence_Fast, including some error wording and length-hint behavior, remain outside this change. AI assistance: OpenAI Codex assisted with implementation and source review. Summary by CodeRabbit Bug Fixes Extending an element now appends valid items encountered before the first invalid item. The operation still raises a TypeError for that invalid item, but earlier valid additions are no longer discarded.
Open Graph Description: Summary Preserve earlier valid children when Element.extend encounters an invalid later item, as CPython does. Materialize the input before mutating the element, preserving existing behavior for s...
X Description: Summary Preserve earlier valid children when Element.extend encounters an invalid later item, as CPython does. Materialize the input before mutating the element, preserving existing behavior for s...
Opengraph URL: https://github.com/RustPython/RustPython/pull/9594
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:0541bd69-b067-60e5-ed29-ed4434cab3e2 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | BE5C:ADA9D:3DD8B0B:4F42DA4:6B02087F |
| html-safe-nonce | 66297cccf6293942bce5853129f73ddd7c85d30accbc9eda53749231b76a7012 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRTVDOkFEQTlEOjNERDhCMEI6NEY0MkRBNDo2QjAyMDg3RiIsInZpc2l0b3JfaWQiOiIyOTI3NTc5MDc5NDU4ODE4MTc1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 20714d95e4e7ee38ce0c67dbb4305afb5b0b156b3f0e6f47250145167c6bfe7d |
| hovercard-subject-tag | pull_request:5136980654 |
| 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/RustPython/RustPython/pull/9594/files |
| twitter:image | https://avatars.githubusercontent.com/u/336763669?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/336763669?s=400&v=4 |
| og:image:alt | Summary Preserve earlier valid children when Element.extend encounters an invalid later item, as CPython does. Materialize the input before mutating the element, preserving existing behavior for s... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/RustPython/RustPython git https://github.com/RustPython/RustPython.git |
| octolytics-dimension-user_id | 39710557 |
| octolytics-dimension-user_login | RustPython |
| octolytics-dimension-repository_id | 135201145 |
| octolytics-dimension-repository_nwo | RustPython/RustPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 135201145 |
| octolytics-dimension-repository_network_root_nwo | RustPython/RustPython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width