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
Comments
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). |
Attached PR 4061 removes os.stat_float_times(). |
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 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." |
os.stat_float_times() has been removed, I close the issue. |
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: