Author: Armin Rigo <[email protected]>
Branch:
Changeset: r88727:68764720cf0c
Date: 2016-11-29 10:23 +0100
http://bitbucket.org/pypy/pypy/changeset/68764720cf0c/
Log: posix.stat_float_times(): the default is not None but -1
diff --git a/pypy/module/posix/interp_posix.py
b/pypy/module/posix/interp_posix.py
--- a/pypy/module/posix/interp_posix.py
+++ b/pypy/module/posix/interp_posix.py
@@ -307,7 +307,8 @@
def __init__(self, space):
self.stat_float_times = True
-def stat_float_times(space, w_value=None):
+@unwrap_spec(newval=int)
+def stat_float_times(space, newval=-1):
"""stat_float_times([newval]) -> oldval
Determine whether os.[lf]stat represents time stamps as float objects.
@@ -317,10 +318,10 @@
"""
state = space.fromcache(StatState)
- if w_value is None:
+ if newval == -1:
return space.wrap(state.stat_float_times)
else:
- state.stat_float_times = space.bool_w(w_value)
+ state.stat_float_times = (newval != 0)
@unwrap_spec(fd=c_int)
diff --git a/pypy/module/posix/test/test_posix2.py
b/pypy/module/posix/test/test_posix2.py
--- a/pypy/module/posix/test/test_posix2.py
+++ b/pypy/module/posix/test/test_posix2.py
@@ -159,11 +159,14 @@
st = posix.stat(path)
assert isinstance(st.st_mtime, float)
assert st[7] == int(st.st_atime)
+ assert posix.stat_float_times(-1) is True
posix.stat_float_times(False)
st = posix.stat(path)
assert isinstance(st.st_mtime, (int, long))
assert st[7] == st.st_atime
+ assert posix.stat_float_times(-1) is False
+
finally:
posix.stat_float_times(current)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit