homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Avoid raising OverflowError in truncate() if possible
Type: enhancement Stage: needs patch
Components: IO, Library (Lib) Versions: Python 3.7
process
Status: open Resolution:
Dependencies: 29852 Superseder:
Assigned To: Nosy List: Oren Milman, benjamin.peterson, nanjekyejoannah, serhiy.storchaka, stutzbach, vstinner
Priority: normal Keywords:

Created on 2017年03月15日 15:11 by serhiy.storchaka, last changed 2022年04月11日 14:58 by admin.

Messages (2)
msg289677 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017年03月15日 15:11
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().
msg289848 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017年03月19日 11:35
Issue29852 is not strict dependency, but it may make the solution of this issue simpler.
History
Date User Action Args
2022年04月11日 14:58:44adminsetgithub: 74005
2019年05月27日 16:44:36nanjekyejoannahsetnosy: + nanjekyejoannah
2017年03月19日 11:35:57serhiy.storchakasetdependencies: + Argument Clinic: add common converter to Py_ssize_t that accepts None
messages: + msg289848
2017年03月17日 08:36:16serhiy.storchakalinkissue29833 dependencies
2017年03月15日 15:12:46vstinnersetnosy: + vstinner
2017年03月15日 15:12:27serhiy.storchakasetnosy: + Oren Milman
2017年03月15日 15:11:06serhiy.storchakacreate

AltStyle によって変換されたページ (->オリジナル) /