[New-bugs-announce] [issue29819] Avoid raising OverflowError in truncate() if possible

Serhiy Storchaka report at bugs.python.org
Wed Mar 15 11:11:06 EDT 2017


New submission from Serhiy Storchaka:

os.truncate(), os.ftruncate() and truncate() methods of file-like objects raise OverflowError when the argument is out of ranger of certain C type. It would be better to extend the behavior of small integers to large integers. ValueError is raised for negative integers and it should be raised for negative integers out of range. Values larger than the current size should be ignored in BytesIO.truncate() and StringIO.truncate(). BytesIO.truncate() and StringIO.truncate() should never raise OverflowError. Since the behavior of underlying OS functions is OS and FS depended, OverflowError can be raised for large integers in os.truncate(), os.ftruncate() and FileIO.truncate().

----------
components: IO, Library (Lib)
messages: 289677
nosy: benjamin.peterson, serhiy.storchaka, stutzbach
priority: normal
severity: normal
stage: needs patch
status: open
title: Avoid raising OverflowError in truncate() if possible
type: enhancement
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29819>
_______________________________________


More information about the New-bugs-announce mailing list