Repository navigation
Fix BarrelList concatenation losing stored items - #540
Closed
theman6660 wants to merge 1 commit into
Closed
theman6660 wants to merge 1 commit into
theman6660 wants to merge 1 commit into
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
BarrelListinheritslist.__add__, which reads the unused base-list storage instead of its partitioned contents:Implement non-mutating forward and reflected concatenation using the actual contents. Preserve the existing plain-list result type, shallow element references, unchanged operands, list-only inputs, and reflected operator dispatch for unsupported operand types. Ordinary list subclasses retain their underlying-storage concatenation semantics.
The regression matrix covers both operand directions and two BarrelLists, single/multiple partitions including empty partitions, empty/nonempty inputs, duplicates, unhashable elements, independent result storage, self-concatenation, non-list rejection, and reflected dispatch.
Validation on Windows / Python 3.12.10 in a virtual environment:
git diff --check: passed.Other Python versions and operating systems have not been tested locally.
The backstory
Earlier contribution: #519, which contains my contribution background. This was found during Codex-assisted checks of the documented list interface while continuing small, verifiable open-source contributions; it was not observed in production. The advertised list-compatible API prompted a comparison with ordinary concatenation, exposing silent loss of the partitioned contents.
AI assistance