]> granicus.if.org Git - python/commitdiff
Issue #14711: os.stat_float_times() has been deprecated.
authorVictor Stinner <victor.stinner@gmail.com>
Mon, 4 Jun 2012 23:22:15 +0000 (01:22 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Mon, 4 Jun 2012 23:22:15 +0000 (01:22 +0200)
Doc/library/os.rst
Lib/test/test_os.py
Misc/NEWS
Modules/posixmodule.c

index 153a1118bb501e9f6d8f07304da392d565dc9ddd..28cf4b4ac0369f27474910a404b8b7a9a263bfd5 100644 (file)
@@ -2128,6 +2128,8 @@ Files and Directories
    are processed, this application should turn the feature off until the library
    has been corrected.
 
+   .. deprecated:: 3.3
+
 
 .. function:: statvfs(path)
 
index 3ee5a1e08a3b1a8e444f6de6c02e6cd140b37b78..d47c8d35a060dfe7128018112a117735c5d75283 100644 (file)
@@ -30,7 +30,9 @@ except ImportError:
     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 @@ class StatAttributeTests(unittest.TestCase):
         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)
index ee5e5ff40e87e0ab81c15f55fe3e37d3c0a3f1e9..b8d09285710f00af19fd64942ee4da29c7c2a2c9 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -15,6 +15,8 @@ Core and Builtins
 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
index 8b8fc8f1634a07051572616d7a278c46322a4343..094108a29f84aaa79d714dc23c88165af6ddd06e 100644 (file)
@@ -1721,6 +1721,10 @@ stat_float_times(PyObject* self, PyObject *args)
     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 @@ typedef struct {
     PyObject *args;
     PyObject *kwargs;
 
-    /* input/output */    
+    /* input/output */
     PyObject **path;
 
     /* output only */
@@ -3655,7 +3659,7 @@ typedef struct {
     timet[1] = ua.mtime_s
 
 
-/* 
+/*
  * utime_read_time_arguments() processes arguments for the utime
  * family of functions.
  */