Skip to content
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

gh-118598: Improve suggestion of TypeError when attempting to iterate over an integer #118602

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vladimirrotariu
Copy link

@vladimirrotariu vladimirrotariu commented May 5, 2024

Copy link

cpython-cla-bot bot commented May 5, 2024

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-app
Copy link

bedevere-app bot commented May 5, 2024

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@@ -130,7 +130,7 @@
Traceback (most recent call last):
File "<pyshell#4>", line 1, in -toplevel-
(i for i in 6)
TypeError: 'int' object is not iterable
TypeError: 'int' object is not iterable. Did you mean: 'range('int')'?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Single quotes within single quotes does not work. Just range(...) or range(<int>) would be better. Change would apply to other patches below.

@terryjreedy terryjreedy requested a review from pablogsal May 5, 2024 17:58
Copy link
Contributor

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note it looks like there isn't consensus on the issue about the best scope for this message.

Adding this to traceback.py based on substring checks also feels a little broad in my opinion, I'd prefer if error message was changed where it is raised.

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

Successfully merging this pull request may close these issues.

None yet

3 participants