[issue13964] os.utimensat() and os.futimes() should accept Decimal, drop os.futimens()

STINNER Victor report at bugs.python.org
Wed Feb 8 02:19:54 CET 2012


New submission from STINNER Victor <victor.stinner at haypocalc.com>:

Python 3.3 has 4 new functions to set the access and modification time of a file (only os.utime() was already present in Python 3.2). New functions taking timestamp with a nanonsecond resolution use a tuple of int because the float type doesn't support nanosecond resolution. Thanks to the PEP 410, we can simplify the API to use a simple number (int, float or Decimal) instead of a tuple of 2 integers.

Current API:

- futimes(fd[, (atime, mtime)]): 1 argument for timestamps
- lutimes(path[, (atime, mtime)]): 1 argument for timestamps
- utime(path[, (atime, mtime)]): 1 argument for timestamps

- futimens(fd[, (atime_sec, atime_nsec), (mtime_sec, mtime_nsec)]): 2 arguments for timestamps
- utimensat(dirfd, path[, atime=(atime_sec, atime_nsec), mtime=(mtime_sec, mtime_nsec), flags=0]): 2 arguments for timestamps

I propose to:

- support Decimal type in all functions: avoid conversion to float to not lose precision
- remove os.futimens(): os.futimes() does already use futimens() if the function is present (and Decimal can be used to get nanosecond resolution)
- change os.utimensat() API to: os.utimensat(dirfd, path[, (atime, mtime), flags=0])

----------
components: Library (Lib)
messages: 152825
nosy: haypo, ncoghlan
priority: normal
severity: normal
status: open
title: os.utimensat() and os.futimes() should accept Decimal, drop os.futimens()
versions: Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13964>
_______________________________________


More information about the Python-bugs-list mailing list