Kaydet (Commit) b0d5b5d3 authored tarafından Brian Curtin's avatar Brian Curtin

Adjust None handling to be a bit more clean. Thanks to Benjamin

for pointing it out.
üst e2618f34
...@@ -3543,7 +3543,7 @@ static PyObject * ...@@ -3543,7 +3543,7 @@ static PyObject *
posix_utime(PyObject *self, PyObject *args) posix_utime(PyObject *self, PyObject *args)
{ {
#ifdef MS_WINDOWS #ifdef MS_WINDOWS
PyObject *arg = NULL; PyObject *arg = Py_None;
PyObject *obwpath; PyObject *obwpath;
wchar_t *wpath = NULL; wchar_t *wpath = NULL;
PyObject *oapath; PyObject *oapath;
...@@ -3589,7 +3589,7 @@ posix_utime(PyObject *self, PyObject *args) ...@@ -3589,7 +3589,7 @@ posix_utime(PyObject *self, PyObject *args)
Py_DECREF(oapath); Py_DECREF(oapath);
} }
if (!arg || (arg == Py_None)) { if (arg == Py_None) {
SYSTEMTIME now; SYSTEMTIME now;
GetSystemTime(&now); GetSystemTime(&now);
if (!SystemTimeToFileTime(&now, &mtime) || if (!SystemTimeToFileTime(&now, &mtime) ||
...@@ -3633,13 +3633,13 @@ done: ...@@ -3633,13 +3633,13 @@ done:
time_t atime, mtime; time_t atime, mtime;
long ausec, musec; long ausec, musec;
int res; int res;
PyObject* arg = NULL; PyObject* arg = Py_None;
if (!PyArg_ParseTuple(args, "O&|O:utime", if (!PyArg_ParseTuple(args, "O&|O:utime",
PyUnicode_FSConverter, &opath, &arg)) PyUnicode_FSConverter, &opath, &arg))
return NULL; return NULL;
path = PyBytes_AsString(opath); path = PyBytes_AsString(opath);
if (!arg || (arg == Py_None)) { if (arg == Py_None) {
/* optional time values not given */ /* optional time values not given */
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
res = utime(path, NULL); res = utime(path, NULL);
......
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