You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
plist([1, 2, 3])[-1:] currently raises IndexError, although PList supports sequence slicing. The optimized suffix-slice path passes the negative start directly to _drop, instead of counting from the end and clipping it as a built-in list does. That path also accepts floating-point starts and rejects objects that implement __index__.
Normalize suffix-slice starts while retaining the existing shared tail. Stop dropping once the list is empty, so an oversized positive start does not keep traversing the empty-list sentinel.
Validation on Python 3.12:
Regression cases before the fix: 19 failed, 16 passed.
pytest tests/list_test.py: 73 passed, including comparisons with built-in list slicing and shared-tail checks.
pytest: 571 passed, 102 skipped (optional C-extension cases are unavailable in this local environment).
git diff --check: passed.
Implementation and regression tests prepared with Codex; the patch and test results were reviewed against the existing PList code.
One small error-path test to add alongside this: test-only commit.
It compares plist with a built-in list when __index__ itself raises. Both should preserve the same exception object, call the provider once, and leave the input unchanged. The new case passes here; the base raises a different TypeError before calling the provider. The built-in oracle and an ordinary shared-tail control pass on both versions.
Focused checks used Windows / CPython 3.14.4 with the pure-Python backend. The full suite, C-extension tests, and other interpreter/platform combinations weren't run.
Optional suggestion: keep this beside the successful __index__ and wrong-type cases, since a provider's own failure is a separate path from an invalid index value.
Thanks for the focused __index__ error-path test. Checking exception identity, a single invocation, and unchanged input is useful additional coverage. I have reviewed the proposed test, but have not applied the optional commit or run it locally.
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
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.
plist([1, 2, 3])[-1:]currently raisesIndexError, although PList supports sequence slicing. The optimized suffix-slice path passes the negative start directly to_drop, instead of counting from the end and clipping it as a built-in list does. That path also accepts floating-point starts and rejects objects that implement__index__.Normalize suffix-slice starts while retaining the existing shared tail. Stop dropping once the list is empty, so an oversized positive start does not keep traversing the empty-list sentinel.
Validation on Python 3.12:
pytest tests/list_test.py: 73 passed, including comparisons with built-in list slicing and shared-tail checks.pytest: 571 passed, 102 skipped (optional C-extension cases are unavailable in this local environment).git diff --check: passed.Implementation and regression tests prepared with Codex; the patch and test results were reviewed against the existing PList code.