Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b0d5b5d

Browse files
committed
Adjust None handling to be a bit more clean. Thanks to Benjamin
for pointing it out.
1 parent e2618f3 commit b0d5b5d

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Modules/posixmodule.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3543,7 +3543,7 @@ static PyObject *
35433543
posix_utime(PyObject *self, PyObject *args)
35443544
{
35453545
#ifdef MS_WINDOWS
3546-
PyObject *arg = NULL;
3546+
PyObject *arg = Py_None;
35473547
PyObject *obwpath;
35483548
wchar_t *wpath = NULL;
35493549
PyObject *oapath;
@@ -3589,7 +3589,7 @@ posix_utime(PyObject *self, PyObject *args)
35893589
Py_DECREF(oapath);
35903590
}
35913591

3592-
if (!arg || (arg == Py_None)) {
3592+
if (arg == Py_None) {
35933593
SYSTEMTIME now;
35943594
GetSystemTime(&now);
35953595
if (!SystemTimeToFileTime(&now, &mtime) ||
@@ -3633,13 +3633,13 @@ posix_utime(PyObject *self, PyObject *args)
36333633
time_t atime, mtime;
36343634
long ausec, musec;
36353635
int res;
3636-
PyObject* arg = NULL;
3636+
PyObject* arg = Py_None;
36373637

36383638
if (!PyArg_ParseTuple(args, "O&|O:utime",
36393639
PyUnicode_FSConverter, &opath, &arg))
36403640
return NULL;
36413641
path = PyBytes_AsString(opath);
3642-
if (!arg || (arg == Py_None)) {
3642+
if (arg == Py_None) {
36433643
/* optional time values not given */
36443644
Py_BEGIN_ALLOW_THREADS
36453645
res = utime(path, NULL);

0 commit comments

Comments
 (0)