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

random.seed() doesn't work with bytes and version=1 #75663

Closed
serhiy-storchaka opened this issue Sep 15, 2017 · 12 comments
Closed

random.seed() doesn't work with bytes and version=1 #75663

serhiy-storchaka opened this issue Sep 15, 2017 · 12 comments
Assignees
Labels
3.7 (EOL) end of life stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@serhiy-storchaka
Copy link
Member

BPO 31482
Nosy @rhettinger, @serhiy-storchaka, @Mariatta
PRs
  • bpo-31482: Missing bytes support for random.seed() version 1 #3614
  • [3.6] bpo-31482: Missing bytes support for random.seed() version 1 (GH-3614) #3629
  • [3.6] bpo-31482: Missing bytes support for random.seed() version 1 (GH-3614) #3659
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/Mariatta'
    closed_at = <Date 2017-09-20.18:04:36.435>
    created_at = <Date 2017-09-15.12:10:39.762>
    labels = ['3.7', 'type-bug', 'library']
    title = "random.seed() doesn't work with bytes and version=1"
    updated_at = <Date 2017-09-20.18:04:36.434>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2017-09-20.18:04:36.434>
    actor = 'Mariatta'
    assignee = 'Mariatta'
    closed = True
    closed_date = <Date 2017-09-20.18:04:36.435>
    closer = 'Mariatta'
    components = ['Library (Lib)']
    creation = <Date 2017-09-15.12:10:39.762>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 31482
    keywords = ['patch']
    message_count = 12.0
    messages = ['302246', '302370', '302512', '302535', '302538', '302540', '302542', '302544', '302547', '302549', '302552', '302647']
    nosy_count = 3.0
    nosy_names = ['rhettinger', 'serhiy.storchaka', 'Mariatta']
    pr_nums = ['3614', '3629', '3659']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue31482'
    versions = ['Python 3.6', 'Python 3.7']

    @serhiy-storchaka
    Copy link
    Member Author

    The behavior of random.seed() with bytes and version=1 is specially documented. But actually it doesn't work.

    >>> import random
    >>> random.seed(b'abc', version=1)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/home/serhiy/py/cpython/Lib/random.py", line 113, in seed
        x = ord(a[0]) << 7 if a else 0
    TypeError: ord() expected string of length 1, but int found

    @serhiy-storchaka serhiy-storchaka added 3.7 (EOL) end of life stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Sep 15, 2017
    @rhettinger
    Copy link
    Contributor

    New changeset 132a7d7 by Raymond Hettinger in branch 'master':
    bpo-31482: Missing bytes support for random.seed() version 1 (bpo-3614)
    132a7d7

    @serhiy-storchaka
    Copy link
    Member Author

    Raymond, why the fix is not backported to 3.6?

    @rhettinger
    Copy link
    Contributor

    Mariatta, what is the procedure for completing the backport? I can see the miss-islington bot made a commit but it didn't take in the 3.6 branch.

    @rhettinger rhettinger assigned Mariatta and unassigned rhettinger Sep 19, 2017
    @serhiy-storchaka
    Copy link
    Member Author

    What is wrong with PR 3629?

    @Mariatta
    Copy link
    Member

    Hi Raymond,

    Somehow the backport PR #3629 was closed before instead of merged.

    To retrigger the backport, we can re-apply the "needs backport to 3.6" label on the original PR (3614). I will do this now :)

    @Mariatta
    Copy link
    Member

    Backport PR has been created. Once the CI checks are done, we can squash and merge it.

    @serhiy-storchaka
    Copy link
    Member Author

    If PR 3629 was closed by mistake it could be just reopened, isn't?

    @Mariatta
    Copy link
    Member

    Serhiy, it can't be re-opened since miss-islington deleted the branch already.

    @serhiy-storchaka
    Copy link
    Member Author

    Ah, now I understand what happened. Thanks Mariatta.

    @Mariatta
    Copy link
    Member

    New changeset c6ce8fb by Mariatta (Miss Islington (bot)) in branch '3.6':
    [3.6] bpo-31482: Missing bytes support for random.seed() version 1 (GH-3614) (GH-3659)
    c6ce8fb

    @Mariatta
    Copy link
    Member

    Backport was done. Thanks.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 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