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.

Title: Remove os.stat_float_times()
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: serhiy.storchaka, vstinner
Priority: normal Keywords: patch

Created on 2017-10-20 14:03 by vstinner, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 4061 merged vstinner, 2017-10-20 14:51
Messages (6)
msg304655 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-10-20 14:03
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 f607bdaa77475ec8c94614414dc2cecf8fd1ca0a.

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 fe33d0ba87f5468b50f939724b303969711f3be5.

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 034d0aa2171688c40cee1a723ddcdb85bbce31e8 (bpo-14711).
msg304660 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-10-20 14:52
Attached PR 4061 removes os.stat_float_times().
msg304719 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-10-21 19:24
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?
msg304875 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-10-24 09:02
New changeset 01b5aab7bfb11ee5476ef52d24495598cbe7c99a by Victor Stinner in branch 'master':
bpo-31827: Remove os.stat_float_times() (GH-4061)
msg304881 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-10-24 09:19
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."
msg304882 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-10-24 09:19
os.stat_float_times() has been removed, I close the issue.
Date User Action Args
2022-04-11 14:58:53adminsetgithub: 76008
2017-10-24 09:19:23vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg304882

stage: patch review -> resolved
2017-10-24 09:19:02vstinnersetmessages: + msg304881
2017-10-24 09:02:02vstinnersetmessages: + msg304875
2017-10-21 19:24:48serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg304719
2017-10-20 14:52:14vstinnersetmessages: + msg304660
components: + Library (Lib)
2017-10-20 14:51:31vstinnersetkeywords: + patch
stage: patch review
pull_requests: + pull_request4030
2017-10-20 14:03:40vstinnercreate