Skip to content

bpo-44110: Improve string's __getitem__ error message#26042

Merged
serhiy-storchaka merged 3 commits into
python:mainfrom
miguendes:bpo-44110
Jun 27, 2021
Merged

bpo-44110: Improve string's __getitem__ error message#26042
serhiy-storchaka merged 3 commits into
python:mainfrom
miguendes:bpo-44110

Conversation

@miguendes

@miguendes miguendes commented May 11, 2021

Copy link
Copy Markdown
Contributor

Comment thread Lib/test/string_tests.py Outdated
@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Jun 18, 2021
@akulakov

Copy link
Copy Markdown
Contributor

A similar enhancement to list IndexError msg was recently rejected for performance reasons. I wonder if the same objection may apply here (most likely less so because the same pattern of catching index errors in a loop would be used rarely with strings). I will try to check performance later today, though I was having some odd issues with pyperf (but this may be a good chance to debug them :) ).

related issue:
https://bugs.python.org/issue44166

@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label Jun 27, 2021
@akulakov

Copy link
Copy Markdown
Contributor

After looking at the pattern that was an issue with the list IndexError, it should not apply to strings, so please ignore my comment!

@serhiy-storchaka

Copy link
Copy Markdown
Member

Yes, because it is a TypeError, not IndexError.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants