[New-bugs-announce] [issue31482] random.seed() doesn't work with bytes and version=1

Serhiy Storchaka report at bugs.python.org
Fri Sep 15 08:10:39 EDT 2017

New submission from Serhiy Storchaka:

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

assignee: rhettinger
components: Library (Lib)
messages: 302246
nosy: rhettinger, serhiy.storchaka
priority: normal
severity: normal
status: open
title: random.seed() doesn't work with bytes and version=1
type: behavior
versions: Python 3.6, Python 3.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list