-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
gh-121288: Make error message for index() methods consistent #121395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
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
Remove the repr of the searched value (which can be arbitrary large) from ValueError messages for list.index(), range.index(), deque.index(), deque.remove() and ShareableList.index(). Make the error messages consistent with error messages for other index() and remove() methods.
rhettinger
approved these changes
Jul 5, 2024
noahbkim
pushed a commit
to hudson-trading/cpython
that referenced
this pull request
Jul 11, 2024
…ythonGH-121395) Make error message for index() methods consistent Remove the repr of the searched value (which can be arbitrary large) from ValueError messages for list.index(), range.index(), deque.index(), deque.remove() and ShareableList.index(). Make the error messages consistent with error messages for other index() and remove() methods.
estyxx
pushed a commit
to estyxx/cpython
that referenced
this pull request
Jul 17, 2024
…ythonGH-121395) Make error message for index() methods consistent Remove the repr of the searched value (which can be arbitrary large) from ValueError messages for list.index(), range.index(), deque.index(), deque.remove() and ShareableList.index(). Make the error messages consistent with error messages for other index() and remove() methods.
gotmax23
added a commit
to gotmax23/domdf_python_tools
that referenced
this pull request
Aug 26, 2025
As of python/cpython#121395, the format of the list.index exception has changed and parsing it like this no longer works. Relying on implementation details like this is always risky, so this solution should be more future-proof.
xflr6
added a commit
to xflr6/concepts
that referenced
this pull request
Oct 8, 2025
domdfcoding
pushed a commit
to gotmax23/domdf_python_tools
that referenced
this pull request
Dec 11, 2025
As of python/cpython#121395, the format of the list.index exception has changed and parsing it like this no longer works. Relying on implementation details like this is always risky, so this solution should be more future-proof.
domdfcoding
added a commit
to domdfcoding/domdf_python_tools
that referenced
this pull request
Dec 11, 2025
* tests: fix pathlib.PurePosixPath repr on py3.14
``` fish
for i in python3.{9,10,11,12,13,14}
echo -n "$i "
$i -c 'import pathlib; print(repr(pathlib.PurePosixPath))'
end
```
```
python3.9 <class 'pathlib.PurePosixPath'>
python3.10 <class 'pathlib.PurePosixPath'>
python3.11 <class 'pathlib.PurePosixPath'>
python3.12 <class 'pathlib.PurePosixPath'>
python3.13 <class 'pathlib._local.PurePosixPath'>
python3.14 <class 'pathlib.PurePosixPath'>
```
* words: fix alphabet_sort exception handling for py3.14
As of python/cpython#121395, the format of the
list.index exception has changed and parsing it like this no longer
works. Relying on implementation details like this is always risky, so
this solution should be more future-proof.
* Skip pathlib.PurePath for from_uri test in Python 3.13
* Configure testing on Python 3.14
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: Dominic Davis-Foster <dominic@davis-foster.co.uk>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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.
Remove the repr of the searched value (which can be arbitrary large) from ValueError messages for list.index(), range.index(), deque.index(), deque.remove() and ShareableList.index(). Make the error messages consistent with error messages for other index() and remove() methods.