New issue 2408: CPython difference: os.utime(path, (-1.1, -1.1)) raises OSError 
on PyPy
https://bitbucket.org/pypy/pypy/issues/2408/cpython-difference-osutime-path-11-11

Jason Madden:

On Linux with PyPy 5.3 and 5.4.0, passing negative floating point values to 
os.utime raises an OSError. This does not happen on OS X with PyPy, and it does 
not happen on any OS that I've tested under CPython.

Compare PyPy (this happens to be an raspbian ARM, but I see the same thing on 
x86_64):
```
$ touch file
$ pypy
Python 2.7.10 (c09c19272c99, Jun 07 2016, 16:46:09)
[PyPy 5.3.0 with GCC 4.7.2 20120731 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>> import os
>>>> os.utime('file', (1.1, 1.1))
>>>> os.utime('file', (-1, -1))
>>>> os.utime('file', (-1.1, -1.1))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 22] Invalid argument: 'file'
```

with CPython:
```
$ /usr/bin/python
Python 2.7.9 (default, Mar  8 2015, 00:52:26)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.utime('file', (1.1, 1.1))
>>> os.utime('file', (-1, -1))
>>> os.utime('file', (-1.1, -1.1))
>>> os.stat('file')
posix.stat_result(st_mode=33188, st_ino=525562L, st_dev=45831L, st_nlink=1, 
st_uid=1001, st_gid=1001, st_size=0L, st_atime=-1, st_mtime=-1, 
st_ctime=1475174715)
```

The most confusing part about this was the error message, which led me to 
believe something was wrong with the path---I went hunting for someplace that 
maybe didn't close the file so it wasn't on disk because of GC reasons.

I ran into this [testing 
RelStorage](https://travis-ci.org/zodb/relstorage/jobs/163795480).


_______________________________________________
pypy-issue mailing list
pypy-issue@python.org
https://mail.python.org/mailman/listinfo/pypy-issue

Reply via email to