Repository navigation
Conversation
There was a problem hiding this comment.
Twenty-eight pop cases matched built-in list behavior with single-partition and fragmented BarrelList storage, including empty tail partitions. The cases covered omitted/default indices, positive/negative endpoints, bool indices, a custom index, None/float/string indices, out-of-range indices and too many arguments. I used Python 3.12.14 against commit 92604dc.
For invalid calls I compared exception types and verified that no item was removed; valid calls returned the same value and left the same sequence as list.pop. The empty-tail plus invalid-argument combination is useful here because validation must happen before cleanup/removal. These were standalone assertions against the fetched listutils module, not the full pytest suite.
|
Folded into #609 (see the PR description for credit). Thanks for the report and the repro. |
The change
BarrelList.pop(None),pop(()),pop(-1.0)andpop(0, 1)silently remove an item instead of raising TypeError. Objects implementing__index__fail even though builtin list accepts them. Validate the argument count and normalize the index before touching partitioned storage.Ten regression cases fail before the fix and pass after it, covering one/multiple partitions, rejected calls leaving contents unchanged, index objects, default/negative indices and empty-list errors. Full tests and doctests on Python 3.14.4/Linux: 688 passed and 12 subtests passed; diff whitespace checks pass. Other Python/platform matrix jobs were not run. The slice-deletion problem already tracked in #549 is outside this change.
The backstory
Earlier contributions from this account include #569 and #570. This issue was found while comparing the documented list-compatible API with builtin list during an automated contribution audit; it was not discovered in a production application. The concrete concern is that invalid calls mutate data rather than reporting the argument error.
AI assistance