New submission from Jim Fasarakis-Hilliard <j...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue45044>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to