Skip to content

gh-110050: Adjust the newline position in the TypeError message of the random.seed call. #110051

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 4 commits into from
Oct 10, 2023

Conversation

yilei
Copy link
Contributor

@yilei yilei commented Sep 28, 2023

@rhettinger
Copy link
Contributor

The newline was intentional. Without it, the error line is 90 characters which is too long:

>>> len('TypeError: The only supported seed types are: None, int, float, str, bytes, and bytearray.')
90

That said, it might be nice to move the newline to just before the None giving a more natural line break.

@yilei
Copy link
Contributor Author

yilei commented Sep 29, 2023

Ah OK, this is a strange convention to me, since in many cases you can't control the length of the message when it also includes strings formatted from other variables. Also, the file names in the trackeback are usually already much longer.

That said, I updated this PR to just adjust the newline position.

Thanks for the review!

@yilei yilei changed the title gh-110050: Use a space instead of newline in the TypeError message of the random.seed call. gh-110050: Adjust the newline position in the TypeError message of the random.seed call. Sep 29, 2023
@ambv ambv merged commit ce43d5f into python:main Oct 10, 2023
@miss-islington
Copy link
Contributor

Thanks @yilei for the PR, and @ambv for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 10, 2023
… of the random.seed call. (pythonGH-110051)

(cherry picked from commit ce43d5f)

Co-authored-by: Yilei Yang <[email protected]>
Co-authored-by: Raymond Hettinger <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Oct 10, 2023

GH-110625 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 only security fixes label Oct 10, 2023
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
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.

5 participants