[pypy-commit] pypy py3.6: CPython Issue #14711: os.stat_float_times() has been deprecated.

amauryfa pypy.commits at gmail.com
Thu Mar 1 06:41:57 EST 2018


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: py3.6
Changeset: r93933:1297ffb4dd1a
Date: 2018-02-26 01:57 +0100
http://bitbucket.org/pypy/pypy/changeset/1297ffb4dd1a/

Log:	CPython Issue #14711: os.stat_float_times() has been deprecated.

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
@@ -586,6 +586,8 @@
 future calls return ints.
 If newval is omitted, return the current setting.
 """
+    space.warn(space.newtext("stat_float_times() is deprecated"),
+               space.w_DeprecationWarning)
     state = space.fromcache(StatState)
 
     if newval == -1:
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
@@ -162,8 +162,12 @@
     def test_stat_float_times(self):
         path = self.path
         posix = self.posix
-        current = posix.stat_float_times()
-        assert current is True
+        import warnings
+        with warnings.catch_warnings(record=True) as l:
+            warnings.simplefilter('always')
+            current = posix.stat_float_times()
+            assert current is True
+        assert "stat_float_times" in repr(l[0].message)
         try:
             posix.stat_float_times(True)
             st = posix.stat(path)
@@ -180,6 +184,7 @@
         finally:
             posix.stat_float_times(current)
 
+
     def test_stat_result(self):
         st = self.posix.stat_result((0, 0, 0, 0, 0, 0, 0, 41, 42.1, 43))
         assert st.st_atime == 41


More information about the pypy-commit mailing list