[Python-checkins] cpython: Issue #14711: os.stat_float_times() has been deprecated.

victor.stinner python-checkins at python.org
Tue Jun 5 01:32:08 CEST 2012


http://hg.python.org/cpython/rev/7cb15b47c70e
changeset:   77359:7cb15b47c70e
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Tue Jun 05 01:22:15 2012 +0200
summary:
  Issue #14711: os.stat_float_times() has been deprecated.

files:
  Doc/library/os.rst    |  2 ++
  Lib/test/test_os.py   |  8 ++++++--
  Misc/NEWS             |  2 ++
  Modules/posixmodule.c |  8 ++++++--
  4 files changed, 16 insertions(+), 4 deletions(-)


diff --git a/Doc/library/os.rst b/Doc/library/os.rst
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -2128,6 +2128,8 @@
    are processed, this application should turn the feature off until the library
    has been corrected.
 
+   .. deprecated:: 3.3
+
 
 .. function:: statvfs(path)
 
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -30,7 +30,9 @@
     threading = None
 from test.script_helper import assert_python_ok
 
-os.stat_float_times(True)
+with warnings.catch_warnings():
+    warnings.simplefilter("ignore", DeprecationWarning)
+    os.stat_float_times(True)
 st = os.stat(__file__)
 stat_supports_subsecond = (
     # check if float and int timestamps are different
@@ -388,7 +390,9 @@
         filename = self.fname
         os.utime(filename, (0, 0))
         set_time_func(filename, atime, mtime)
-        os.stat_float_times(True)
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", DeprecationWarning)
+            os.stat_float_times(True)
         st = os.stat(filename)
         self.assertAlmostEqual(st.st_atime, atime, places=3)
         self.assertAlmostEqual(st.st_mtime, mtime, places=3)
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -15,6 +15,8 @@
 Library
 -------
 
+- Issue #14711: os.stat_float_times() has been deprecated.
+
 - LZMAFile now accepts the modes "rb"/"wb"/"ab" as synonyms of "r"/"w"/"a".
 
 - The bz2 and lzma modules now each contain an open() function, allowing
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -1721,6 +1721,10 @@
     int newval = -1;
     if (!PyArg_ParseTuple(args, "|i:stat_float_times", &newval))
         return NULL;
+    if (PyErr_WarnEx(PyExc_DeprecationWarning,
+                     "stat_float_times() is deprecated",
+                     1))
+        return NULL;
     if (newval == -1)
         /* Return old value */
         return PyBool_FromLong(_stat_float_times);
@@ -3605,7 +3609,7 @@
     PyObject *args;
     PyObject *kwargs;
 
-    /* input/output */    
+    /* input/output */
     PyObject **path;
 
     /* output only */
@@ -3655,7 +3659,7 @@
     timet[1] = ua.mtime_s
 
 
-/* 
+/*
  * utime_read_time_arguments() processes arguments for the utime
  * family of functions.
  */

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list