Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid raising OverflowError in truncate() if possible #74005

Open
Tracked by #74019
serhiy-storchaka opened this issue Mar 15, 2017 · 2 comments
Open
Tracked by #74019

Avoid raising OverflowError in truncate() if possible #74005

serhiy-storchaka opened this issue Mar 15, 2017 · 2 comments
Labels
3.7 (EOL) end of life stdlib Python modules in the Lib dir topic-IO type-feature A feature request or enhancement

Comments

@serhiy-storchaka
Copy link
Member

BPO 29819
Nosy @vstinner, @benjaminp, @serhiy-storchaka, @orenmn, @nanjekyejoannah
Dependencies
  • bpo-29852: Argument Clinic: add common converter to Py_ssize_t that accepts None
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2017-03-15.15:11:06.614>
    labels = ['3.7', 'type-feature', 'library', 'expert-IO']
    title = 'Avoid raising OverflowError in truncate() if possible'
    updated_at = <Date 2019-05-27.16:44:36.338>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2019-05-27.16:44:36.338>
    actor = 'nanjekyejoannah'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)', 'IO']
    creation = <Date 2017-03-15.15:11:06.614>
    creator = 'serhiy.storchaka'
    dependencies = ['29852']
    files = []
    hgrepos = []
    issue_num = 29819
    keywords = []
    message_count = 2.0
    messages = ['289677', '289848']
    nosy_count = 6.0
    nosy_names = ['vstinner', 'benjamin.peterson', 'stutzbach', 'serhiy.storchaka', 'Oren Milman', 'nanjekyejoannah']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = 'needs patch'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue29819'
    versions = ['Python 3.7']

    @serhiy-storchaka
    Copy link
    Member Author

    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().

    @serhiy-storchaka serhiy-storchaka added 3.7 (EOL) end of life stdlib Python modules in the Lib dir topic-IO type-feature A feature request or enhancement labels Mar 15, 2017
    @serhiy-storchaka
    Copy link
    Member Author

    bpo-29852 is not strict dependency, but it may make the solution of this issue simpler.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life stdlib Python modules in the Lib dir topic-IO type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant