Skip to content

Commit

Permalink
Issue #14711: os.stat_float_times() has been deprecated.
Browse files Browse the repository at this point in the history
  • Loading branch information
vstinner committed Jun 4, 2012
1 parent e860404 commit 034d0aa
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Doc/library/os.rst
Expand Up @@ -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)

Expand Down
8 changes: 6 additions & 2 deletions Lib/test/test_os.py
Expand Up @@ -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
Expand Down Expand Up @@ -388,7 +390,9 @@ def _test_utime_subsecond(self, set_time_func):
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)
Expand Down
2 changes: 2 additions & 0 deletions Misc/NEWS
Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions Modules/posixmodule.c
Expand Up @@ -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);
Expand Down Expand Up @@ -3605,7 +3609,7 @@ typedef struct {
PyObject *args;
PyObject *kwargs;

/* input/output */
/* input/output */
PyObject **path;

/* output only */
Expand Down Expand Up @@ -3655,7 +3659,7 @@ typedef struct {
timet[1] = ua.mtime_s


/*
/*
* utime_read_time_arguments() processes arguments for the utime
* family of functions.
*/
Expand Down

0 comments on commit 034d0aa

Please sign in to comment.