Commit 034d0aa2 authored by Victor Stinner's avatar Victor Stinner

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

parent e860404e
...@@ -2128,6 +2128,8 @@ Files and Directories ...@@ -2128,6 +2128,8 @@ Files and Directories
are processed, this application should turn the feature off until the library are processed, this application should turn the feature off until the library
has been corrected. has been corrected.
.. deprecated:: 3.3
.. function:: statvfs(path) .. function:: statvfs(path)
......
...@@ -30,7 +30,9 @@ except ImportError: ...@@ -30,7 +30,9 @@ except ImportError:
threading = None threading = None
from test.script_helper import assert_python_ok 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__) st = os.stat(__file__)
stat_supports_subsecond = ( stat_supports_subsecond = (
# check if float and int timestamps are different # check if float and int timestamps are different
...@@ -388,6 +390,8 @@ class StatAttributeTests(unittest.TestCase): ...@@ -388,6 +390,8 @@ class StatAttributeTests(unittest.TestCase):
filename = self.fname filename = self.fname
os.utime(filename, (0, 0)) os.utime(filename, (0, 0))
set_time_func(filename, atime, mtime) set_time_func(filename, atime, mtime)
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
os.stat_float_times(True) os.stat_float_times(True)
st = os.stat(filename) st = os.stat(filename)
self.assertAlmostEqual(st.st_atime, atime, places=3) self.assertAlmostEqual(st.st_atime, atime, places=3)
......
...@@ -15,6 +15,8 @@ Core and Builtins ...@@ -15,6 +15,8 @@ Core and Builtins
Library Library
------- -------
- Issue #14711: os.stat_float_times() has been deprecated.
- LZMAFile now accepts the modes "rb"/"wb"/"ab" as synonyms of "r"/"w"/"a". - 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 - The bz2 and lzma modules now each contain an open() function, allowing
......
...@@ -1721,6 +1721,10 @@ stat_float_times(PyObject* self, PyObject *args) ...@@ -1721,6 +1721,10 @@ stat_float_times(PyObject* self, PyObject *args)
int newval = -1; int newval = -1;
if (!PyArg_ParseTuple(args, "|i:stat_float_times", &newval)) if (!PyArg_ParseTuple(args, "|i:stat_float_times", &newval))
return NULL; return NULL;
if (PyErr_WarnEx(PyExc_DeprecationWarning,
"stat_float_times() is deprecated",
1))
return NULL;
if (newval == -1) if (newval == -1)
/* Return old value */ /* Return old value */
return PyBool_FromLong(_stat_float_times); return PyBool_FromLong(_stat_float_times);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment