[issue15382] os.utime() mishandles some arguments

2019-09-09 Thread STINNER Victor


STINNER Victor  added the comment:

By the way, error messages are now also correct:

>>> os.utime("x", ns=None)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: utime: 'ns' must be a tuple of two ints

>>> os.utime("x", times=(0, 0), ns=None)
Traceback (most recent call last):
  File "", line 1, in 
ValueError: utime: you may specify either 'times' or 'ns' but not both

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15382] os.utime() mishandles some arguments

2019-09-09 Thread STINNER Victor


STINNER Victor  added the comment:

> 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))
: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.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15382] os.utime() mishandles some arguments

2019-09-07 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

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.

--
nosy: +serhiy.storchaka
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15382] os.utime() mishandles some arguments

2019-09-06 Thread Dong-hee Na


Dong-hee Na  added the comment:

@vstinner
This issue is not solved yet.
Can I finalize this issue?

--
nosy: +corona10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15382] os.utime() mishandles some arguments

2012-07-17 Thread Roger Serwy

Roger Serwy  added the comment:

_rev1 has a basic test. Is it sufficient?

--
Added file: http://bugs.python.org/file26423/issue15382_rev1.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15382] os.utime() mishandles some arguments

2012-07-17 Thread STINNER Victor

STINNER Victor  added the comment:

@serwy: can you please write a test for your patch?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15382] os.utime() mishandles some arguments

2012-07-17 Thread Roger Serwy

Roger Serwy  added the comment:

Attached is a preliminary patch to check ns != Py_None.

--
components: +Library (Lib)
keywords: +patch
nosy: +serwy
type:  -> behavior
Added file: http://bugs.python.org/file26421/issue15382.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15382] os.utime() mishandles some arguments

2012-07-17 Thread Arfrever Frehtes Taifersar Arahesis

New submission from Arfrever Frehtes Taifersar Arahesis 
:

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 "", line 1, in 
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 "", line 1, in 
ValueError: utime: you may specify either 'times' or 'ns' but not both
>>>

--
messages: 165730
nosy: Arfrever, haypo, larry
priority: normal
severity: normal
status: open
title: os.utime() mishandles some arguments
versions: Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com