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.
Created on 2012年07月17日 21:02 by Arfrever, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| issue15382.patch | roger.serwy, 2012年07月17日 23:08 | review | ||
| issue15382_rev1.patch | roger.serwy, 2012年07月17日 23:19 | review | ||
| Messages (8) | |||
|---|---|---|---|
| msg165730 - (view) | Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) * (Python triager) | Date: 2012年07月17日 21:02 | |
Contrarily to documentation: 1. os.utime() accepts a tuple with floats passed by ns argument: >>> os.utime(file, ns=(0.5, 0.5)) >>> 2. os.utime() does not accept explicit ns=None: >>> os.utime(file, times=None) >>> os.utime(file, ns=None) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: utime: 'ns' must be a tuple of two ints >>> 3. os.utime() does not accept both times and ns when only times is a tuple: >>> os.utime(file, times=None, ns=(0, 0)) >>> os.utime(file, times=(0, 0), ns=None) Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: utime: you may specify either 'times' or 'ns' but not both >>> |
|||
| msg165733 - (view) | Author: Roger Serwy (roger.serwy) * (Python committer) | Date: 2012年07月17日 23:08 | |
Attached is a preliminary patch to check ns != Py_None. |
|||
| msg165734 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2012年07月17日 23:10 | |
@serwy: can you please write a test for your patch? |
|||
| msg165736 - (view) | Author: Roger Serwy (roger.serwy) * (Python committer) | Date: 2012年07月17日 23:19 | |
_rev1 has a basic test. Is it sufficient? |
|||
| msg351279 - (view) | Author: Dong-hee Na (corona10) * (Python committer) | Date: 2019年09月07日 04:11 | |
@vstinner This issue is not solved yet. Can I finalize this issue? |
|||
| msg351298 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2019年09月07日 09:45 | |
The documentation issue was fixed in issue23738. The documentation no longer claims that ns can be None. If specified it must be a tuple of floats. |
|||
| msg351365 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2019年09月09日 08:54 | |
> The documentation issue was fixed in issue23738. The documentation no longer claims that ns can be None. If specified it must be a tuple of floats. tuple of integers, not tuple a floats. Python 3.9 documentation says: "If ns is specified, it must be a 2-tuple of the form (atime_ns, mtime_ns) where each member is an int expressing nanoseconds." which is correct. Python 3.9 now emits a DeprecationWarning when passing floats: vstinner@apu$ ./python Python 3.9.0a0 (heads/pr/15701-dirty:a0f335c74c, Sep 6 2019, 17:38:14) >>> import os >>> os.utime("x", ns=(1, 1)) >>> os.utime("x", ns=(0.1, 1)) <stdin>:1: DeprecationWarning: an integer is required (got type float). Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python. |
|||
| msg351366 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2019年09月09日 09:01 | |
By the way, error messages are now also correct:
>>> os.utime("x", ns=None)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: utime: 'ns' must be a tuple of two ints
>>> os.utime("x", times=(0, 0), ns=None)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: utime: you may specify either 'times' or 'ns' but not both
|
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:33 | admin | set | github: 59587 |
| 2019年09月09日 09:01:47 | vstinner | set | messages: + msg351366 |
| 2019年09月09日 08:54:43 | vstinner | set | messages: + msg351365 |
| 2019年09月07日 09:45:24 | serhiy.storchaka | set | status: open -> closed nosy: + serhiy.storchaka messages: + msg351298 resolution: out of date stage: resolved |
| 2019年09月07日 04:11:20 | corona10 | set | nosy:
+ corona10 messages: + msg351279 |
| 2012年07月17日 23:19:44 | roger.serwy | set | files:
+ issue15382_rev1.patch messages: + msg165736 |
| 2012年07月17日 23:10:39 | vstinner | set | messages: + msg165734 |
| 2012年07月17日 23:08:24 | roger.serwy | set | files:
+ issue15382.patch type: behavior components: + Library (Lib) keywords: + patch nosy: + roger.serwy messages: + msg165733 |
| 2012年07月17日 21:02:38 | Arfrever | create | |