Skip to content

The TypeError message from random.seed call has a seemingly unintentional newline in the middle #110050

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

Closed
yilei opened this issue Sep 28, 2023 · 1 comment
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@yilei
Copy link
Contributor

yilei commented Sep 28, 2023

Bug report

Bug description:

>>> import random
>>> random.seed(random)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "...lib/python3.12/random.py", line 167, in seed
    raise TypeError('The only supported seed types are: None,\n'
TypeError: The only supported seed types are: None,
int, float, str, bytes, and bytearray.

It appears that the newline in the middle added in #25874 isn't intentional.

I'll send a PR.

CPython versions tested on:

3.12

Operating systems tested on:

Linux

Linked PRs

@yilei yilei added the type-bug An unexpected behavior, bug, or error label Sep 28, 2023
yilei added a commit to yilei/cpython that referenced this issue Sep 28, 2023
ambv pushed a commit that referenced this issue Oct 10, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this issue 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]>
@iritkatriel iritkatriel added the stdlib Python modules in the Lib dir label Nov 24, 2023
@encukou
Copy link
Member

encukou commented Mar 8, 2024

Thank you for the fix!
It won't appear in 3.12 as it could break code that relies on the old wording, but it did get into 3.13.

@encukou encukou closed this as completed Mar 8, 2024
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants