[issue29025] random.seed() relation to hash() function and its determinism is vague
Jakub Mateusz Kowalski added the comment: Python 2.7 I think note to the docs is enough. Python 3.5+ I have a doubt. Isn't .seed(a, version=1) still coupled with PYTHONHASHSEED? The manual says version 1 is "reproducing random sequences from older versions of Python", and for 3.1 (and earlier) hash() is used, which (according to the manual) depends on PYTHONHASHSEED. Also, in Python 3.2-3.4 it is stated explicitly, that hash() is used. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29025> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29025] random.seed() relation to hash() function and its determinism is vague
New submission from Jakub Mateusz Kowalski: 2.7 (https://docs.python.org/2/library/random.html#random.seed) - warning about PYTHONHASHSEED (environmental variable) voiding determinism - no warning on -R interpreter switch - relation to hash() function omitted 2.6 (https://docs.python.org/2.6/library/random.html#random.seed) 3.0 (https://docs.python.org/3.0/library/random.html#random.seed) 3.1 (https://docs.python.org/3.1/library/random.html#random.seed) 3.2 (https://docs.python.org/3.2/library/random.html#random.seed) 3.3 (https://docs.python.org/3.3/library/random.html#random.seed) 3.4 (https://docs.python.org/3.4/library/random.html#random.seed) - no warning about PYTHONHASHSEED nor -R switch - relation to hash() function acknowledged 3.5 (https://docs.python.org/3.5/library/random.html#random.seed) 3.6 (https://docs.python.org/3.6/library/random.html#random.seed) 3.7 (https://docs.python.org/3.7/library/random.html#random.seed) - no warning about PYTHONHASHSEED nor -R switch - relation to hash() function omitted -- assignee: docs@python components: Documentation messages: 283688 nosy: Jakub.Mateusz.Kowalski, docs@python priority: normal severity: normal status: open title: random.seed() relation to hash() function and its determinism is vague versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29025> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29023] Results of random.seed() call with integer argument should be claimed deterministic.
New submission from Jakub Mateusz Kowalski: In https://docs.python.org/2/library/random.html#random.seed I can find that "If a hashable object is given, deterministic results are only assured when PYTHONHASHSEED is disabled." Both int and long are hashable. However, tests on the random module as well as C source code of random_seed (as indicated in http://stackoverflow.com/a/41228062/4879688) suggest that behaviour of the module is deterministic when seeded with an integer. -- assignee: docs@python components: Documentation messages: 283686 nosy: Jakub.Mateusz.Kowalski, docs@python priority: normal severity: normal status: open title: Results of random.seed() call with integer argument should be claimed deterministic. versions: Python 2.7 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29023> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24490] DeprecationWarning hidden even after warnings.filterwarnings('always') called
New submission from Jakub Mateusz Kowalski: The error occurs when there was a warning before the call to filterwarnings(): $ python Python 2.7.6 (default, Mar 22 2014, 22:59:56) [GCC 4.8.2] on linux2 Type help, copyright, credits or license for more information. import warnings warnings.warn('aa', DeprecationWarning) warnings.filterwarnings('always') warnings.warn('aa', DeprecationWarning) When filterwarnings() is called before warnings, everything is working as expected: $ python Python 2.7.6 (default, Mar 22 2014, 22:59:56) [GCC 4.8.2] on linux2 Type help, copyright, credits or license for more information. import warnings warnings.filterwarnings('always') warnings.warn('aa', DeprecationWarning) __main__:1: DeprecationWarning: aa warnings.warn('aa', DeprecationWarning) __main__:1: DeprecationWarning: aa -- components: Interpreter Core messages: 245691 nosy: Jakub.Mateusz.Kowalski priority: normal severity: normal status: open title: DeprecationWarning hidden even after warnings.filterwarnings('always') called type: behavior versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24490 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22526] file iteration crashes for huge lines (2GiB+)
New submission from Jakub Mateusz Kowalski: File /tmp/2147483648zeros is 2^31 (2GiB) zero-bytes ('\0'). Readline method works fine: fh = open('/tmp/2147483648zeros', 'rb') line = fh.readline() len(line) 2147483648 However when I try to iterate over the file: fh = open('/tmp/2147483648zeros', 'rb') for line in fh: ... print len(line) SystemError Traceback (most recent call last) /home/jkowalski/ipython-input-55-aaa9ddb42aea in module() 1 for line in fh: 2 print len(line) 3 SystemError: Negative size passed to PyString_FromStringAndSize Same is for greater files (issue discovered for 2243973120 B). For a shorter file iteration works as expected. File /tmp/2147483647zeros is 2^31 - 1 ( 2GiB) zero-bytes. fh = open('/tmp/2147483647zeros', 'rb') for line in fh: ... print len(line) 2147483647 I guess the variable used for size is of 32bit signed type. I am using Python 2.7.3 (default, Feb 27 2014, 19:58:35) with IPython 0.12.1 on Ubuntu 12.04.5 LTS. -- components: IO messages: 227949 nosy: Jakub.Mateusz.Kowalski priority: normal severity: normal status: open title: file iteration crashes for huge lines (2GiB+) type: crash versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22526 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com