summaryrefslogtreecommitdiffstats
path: root/Modules/posixmodule.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-10-24 09:02:00 (GMT)
committerGitHub <noreply@github.com>2017-10-24 09:02:00 (GMT)
commit01b5aab7bfb11ee5476ef52d24495598cbe7c99a (patch)
treed21899c9bf7a80014b9e14bd27c0cf88ed6da290 /Modules/posixmodule.c
parent87d332dcdbffe8ff60d99f74b1ad241c0967b055 (diff)
downloadcpython-01b5aab7bfb11ee5476ef52d24495598cbe7c99a.zip
cpython-01b5aab7bfb11ee5476ef52d24495598cbe7c99a.tar.gz
cpython-01b5aab7bfb11ee5476ef52d24495598cbe7c99a.tar.bz2
bpo-31827: Remove os.stat_float_times() (GH-4061)
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r--Modules/posixmodule.c48
1 files changed, 4 insertions, 44 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 639e450..c7d8b00 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -1934,36 +1934,6 @@ statresult_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
}
-
-/* If true, st_?time is float. */
-static int _stat_float_times = 1;
-
-PyDoc_STRVAR(stat_float_times__doc__,
-"stat_float_times([newval]) -> oldval\n\n\
-Determine whether os.[lf]stat represents time stamps as float objects.\n\
-\n\
-If value is True, future calls to stat() return floats; if it is False,\n\
-future calls return ints.\n\
-If value is omitted, return the current setting.\n");
-
-/* AC 3.5: the public default value should be None, not ready for that yet */
-static PyObject*
-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);
- _stat_float_times = newval;
- Py_RETURN_NONE;
-}
-
static PyObject *billion = NULL;
static void
@@ -1986,14 +1956,9 @@ fill_time(PyObject *v, int index, time_t sec, unsigned long nsec)
if (!ns_total)
goto exit;
- if (_stat_float_times) {
- float_s = PyFloat_FromDouble(sec + 1e-9*nsec);
- if (!float_s)
- goto exit;
- }
- else {
- float_s = s;
- Py_INCREF(float_s);
+ float_s = PyFloat_FromDouble(sec + 1e-9*nsec);
+ if (!float_s) {
+ goto exit;
}
PyStructSequence_SET_ITEM(v, index, s);
@@ -2084,11 +2049,7 @@ _pystat_fromstructstat(STRUCT_STAT *st)
#else
bnsec = 0;
#endif
- if (_stat_float_times) {
- val = PyFloat_FromDouble(bsec + 1e-9*bnsec);
- } else {
- val = PyLong_FromLong((long)bsec);
- }
+ val = PyFloat_FromDouble(bsec + 1e-9*bnsec);
PyStructSequence_SET_ITEM(v, ST_BIRTHTIME_IDX,
val);
}
@@ -12452,7 +12413,6 @@ static PyMethodDef posix_methods[] = {
OS_RENAME_METHODDEF
OS_REPLACE_METHODDEF
OS_RMDIR_METHODDEF
- {"stat_float_times", stat_float_times, METH_VARARGS, stat_float_times__doc__},
OS_SYMLINK_METHODDEF
OS_SYSTEM_METHODDEF
OS_UMASK_METHODDEF