You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
with Python 3.9 on macOS shows an mtime (st_mtime_ns) of 0 ns when it should be 34 nanoseconds. When replacing 34 with 999, st_mtime_ns is still 0 but when replacing it with 1000 or 1001, st_mtime_ns is 1000.
This does not happen with Python 3.9 installed via Homebrew, where the timestamp correctly keeps the 1 nanosecond resolution.
Changing the file path from using tempfile.mkdtemp() to hardcoding a path to a file in the home directory does not change anything.
The Nixpkgs Python version shows this behaviour on two different macOS installations.
On Linux this works correctly when using Python from Nixpkgs.
I determined that os.utime() causes the problem while os.stat() works correctly.
Steps To Reproduce
Steps to reproduce the behavior:
Use macOS
Execute nix-shell -p python3
Execute python3
Copy & paste the above python code
See that st_mtime_ns is 0 instead of 34.
Expected behavior
I expect os.utime() to have nanosecond resolution as with the Homebrew version and on Linux.
Additional context
This causes a test failure with the latest (unreleased) master version of kitty: kovidgoyal/kitty#4175.
Metadata
Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.
It looks like this is because x86_64-darwin currently builds against the macOS 10.12 SDK [1], which does not have available the futimens and utimensat functions [2] that os.utime() needs [3] to set the time with nanosecond resolution. If not present, it falls back to microsecond resolution.
Describe the bug
Executing the python code
with Python 3.9 on macOS shows an mtime (
st_mtime_ns
) of 0 ns when it should be 34 nanoseconds. When replacing 34 with 999,st_mtime_ns
is still 0 but when replacing it with 1000 or 1001,st_mtime_ns
is 1000.This does not happen with Python 3.9 installed via Homebrew, where the timestamp correctly keeps the 1 nanosecond resolution.
Changing the file path from using
tempfile.mkdtemp()
to hardcoding a path to a file in the home directory does not change anything.The Nixpkgs Python version shows this behaviour on two different macOS installations.
On Linux this works correctly when using Python from Nixpkgs.
I determined that
os.utime()
causes the problem whileos.stat()
works correctly.Steps To Reproduce
Steps to reproduce the behavior:
nix-shell -p python3
python3
st_mtime_ns
is 0 instead of 34.Expected behavior
I expect
os.utime()
to have nanosecond resolution as with the Homebrew version and on Linux.Additional context
This causes a test failure with the latest (unreleased) master version of kitty: kovidgoyal/kitty#4175.
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.Maintainer information:
The text was updated successfully, but these errors were encountered: