[New-bugs-announce] [issue45044] Agreeing on error raised by large repeat value for sequences
Jim Fasarakis-Hilliard
report at bugs.python.org
Sun Aug 29 08:34:46 EDT 2021
New submission from Jim Fasarakis-Hilliard <jfh at imijmi.eu>:
There's currently a slight disagreement between some of the sequences about what is raised when the value for `repeat` is too large.
Currently, `str` and `bytes` raise an `OverflowError` while `bytearray`, `tuple`, `list` and `deque` raise a `MemoryError`.
To make things more confusing, if we exercise a different path not currently caught by the check, both `str` and `bytes` raise `MemoryError`s:
>>> b'abc' * maxsize
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: repeated bytes are too long
>>> b'a' * maxsize
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
MemoryError
Not sure what the original rationale for having these `OverflowError`s was but, should we change them to `MemoryError`s?
----------
messages: 400527
nosy: Jim Fasarakis-Hilliard
priority: normal
severity: normal
status: open
title: Agreeing on error raised by large repeat value for sequences
type: behavior
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45044>
_______________________________________
More information about the New-bugs-announce
mailing list