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

Remove os.stat_float_times() #76008

vstinner opened this issue Oct 20, 2017 · 6 comments

Remove os.stat_float_times() #76008

vstinner opened this issue Oct 20, 2017 · 6 comments
3.7 (EOL) end of life stdlib Python modules in the Lib dir


Copy link

BPO 31827
Nosy @vstinner, @serhiy-storchaka
  • bpo-31827: Remove os.stat_float_times() #4061
  • 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 = <Date 2017-10-24.09:19:23.678>
    created_at = <Date 2017-10-20.14:03:40.126>
    labels = ['3.7', 'library']
    title = 'Remove os.stat_float_times()'
    updated_at = <Date 2017-10-24.09:19:23.677>
    user = '' fields:

    activity = <Date 2017-10-24.09:19:23.677>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-10-24.09:19:23.678>
    closer = 'vstinner'
    components = ['Library (Lib)']
    creation = <Date 2017-10-20.14:03:40.126>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 31827
    keywords = ['patch']
    message_count = 6.0
    messages = ['304655', '304660', '304719', '304875', '304881', '304882']
    nosy_count = 2.0
    nosy_names = ['vstinner', 'serhiy.storchaka']
    pr_nums = ['4061']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = ''
    versions = ['Python 3.7']

    Copy link
    Member Author

    os.stat_float_times() was introduced in Python 2.3 to get file modification times with sub-second resolution. The default remains to get time as seconds (integer). See commit f607bda.

    The function was introduced to get a smooth transition to time as floating point number, to keep the backward compatibility with Python 2.2.

    In Python 2.5, os.stat() returns time as float by default: commit fe33d0b.

    Python 2.5 was released 11 years ago. I consider that people had enough time to migrate their code to float time :-)

    I modified os.stat_float_times() to emit a DeprecationWarning in Python 3.1: commit 034d0aa (bpo-14711).

    @vstinner vstinner added the 3.7 (EOL) end of life label Oct 20, 2017
    Copy link
    Member Author

    Attached PR 4061 removes os.stat_float_times().

    @vstinner vstinner added the stdlib Python modules in the Lib dir label Oct 20, 2017
    Copy link

    stat_result is a named 10-tuple, containing several additional attributes. The last three items are st_atime, st_mtime and st_ctime as integers. Accessing them by name returns floats. Isn't a time to make them floats when access stat_result as a tuple?

    Copy link
    Member Author

    New changeset 01b5aab by Victor Stinner in branch 'master':
    bpo-31827: Remove os.stat_float_times() (GH-4061)

    Copy link
    Member Author

    Copy of my comment on the PR: "So, I tried to remove the backward compatibility layer: I modified stat_result[ST_MTIME] to return float rather than int. Problem: it broke test_logging, the code deciding if a log file should be rotated or not.

    While I'm not strongly opposed to modify stat_result[ST_MTIME], I prefer to do it in a separated PR. Moreover, we need maybe to emit a DeprecationWarning, or at least deprecate the feature in the doc, before changing the type, no?"

    Serhiy's answer: "I agree, it should be done in a separate issue. It needs a special discussion. And maybe this can't be changed."

    Copy link
    Member Author

    os.stat_float_times() has been removed, I close the issue.

    @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
    3.7 (EOL) end of life stdlib Python modules in the Lib dir
    None yet

    No branches or pull requests

    2 participants