GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |
GeezerVison is showing github.com — gh-146022: Fix free-threading crash in xml.etree.ElementTree's Element by NAVEENKUMARKR777 · Pull Request #157000 · python/cpython ConversationSummaryFixes gh-146022. ChangesAdd the standard critical-section locking used throughout the rest of the free-threaded build:
Along the way, this surfaced a real MSVC portability issue: a This is intentionally scoped to Test plan
🤖 Generated with Claude Code
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions…Element _elementtree.c declares Py_MOD_GIL_NOT_USED but has no locking at all, so concurrent readers and writers race on the Element type's internal ElementObjectExtra struct (self->extra). For example, Element.clear() sets self->extra to NULL and frees the old struct while another thread concurrently indexes or measures the length of the same element, causing a use-after-free/NULL-deref segfault. Add the standard Py_BEGIN/END_CRITICAL_SECTION locking to every raw C slot (__getitem__, __setitem__, __len__, __bool__, and the two subscript slots, via the established *_lock_held extraction pattern for functions with multiple return paths) and every tag/text/tail/attrib property accessor, and add @critical_section Argument Clinic annotations to the methods that read or write self->extra (append, clear, extend, insert, remove, set, get, items, keys, find/findtext/ findall, __copy__/__deepcopy__/__sizeof__/__getstate__/__setstate__). Verified against the reported crash reproducer (reliably segfaults without this change, does not with it), a broader multithreaded stress test exercising every touched method concurrently, and the full test_xml_etree/test_xml_etree_c suites on both a regular and a free-threaded (--disable-gil) Windows build. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Member
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersNo reviewsUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabelsProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. Makexml.etree.ElementTree.Element usable on free-threaded builds
Uh oh!
There was an error while loading. Please reload this page. Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later. | |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |