Repository navigation
Conversation
Owner
|
Folded into #609 (see the PR description for credit). Thanks for the report and the repro. |
blebo
pushed a commit
to blebo/boltons
that referenced
this pull request
Nov 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The change
BarrelList.clear()currently leaves every item in place:BarrelListstores its contents inself.lists, but inheritslist.clear(), which only clears the unused base-list storage. Add an override that clears each underlying list and restores one empty list for subsequent mutations. Clearing the underlying lists also releases items held by an already-started iterator, so that iterator cannot continue yielding removed items.Six regression/control cases cover empty, single-item, ordinary and balanced 30,000-item lists; repeated clearing; subsequent append/insert/extend/index assignment/deletion/pop; and weak-reference release with unstarted and started iterators. Five cases fail against the unchanged upstream source at
4e5faa3; all pass with this change.Validation executed locally on Windows:
python -m tox -e py39,py312,py314 -- -q: 684 passed in each environment, using CPython 3.9.13, 3.12.14 and 3.14.0. This includes building and installing the package before testing; Python 3.12/3.14 also report 12 passing subtests.check --select E9,Fandformat --checkwith the repository's single-quote style.compileallandgit diff --checkpass.__setitem__(start,stop,step); comparison with the base source confirms no new findings. Python 3.14 retains the same five unrelated deprecation warnings as the baseline.Linux/macOS and the remaining upstream interpreter matrix were not run locally.
The backstory
Earlier contribution from this account: #523. This defect was found during the user's request for another useful, reproducible open-source contribution, while checking
BarrelListagainst its documented list-compatible API. Searches of existing issues and PRs found no corresponding clear fix. PR #517 changes self-extension and does not implement this method.AI assistance
Original contribution request
Submission follow-up
The initial GitHub MCP submission returned HTTP 403 and created no PR. The user subsequently authorized GitHub CLI and requested:
其他聊天留下的失败任务也全部重试一遍(retry all failed submissions from the other chats). Codex rechecked upstream master and duplicate PRs, reviewed the existing diff, and reran the full tests and doctests on Windows / CPython 3.14 before this submission. GitHub CLI is used for submission. No new source changes were made during the retry.