This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: posixmodule.c always using res = utime(path, NULL)
Type: compile error Stage: resolved
Components: Extension Modules Versions: Python 3.1, Python 3.2, Python 2.7
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: jszakmeister, oskar86, r.david.murray
Priority: normal Keywords: patch

Created on 2008-07-22 13:56 by oskar86, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit
issue-3425-utimes.patch jszakmeister, 2009-05-28 10:07 Patch to use utimes() when the arg is None.
Messages (3)
msg70147 - (view) Author: Oskar Andersson (oskar86) Date: 2008-07-22 13:56
I'm porting, embedding and extending Python in a very limited environment.

This environment does not have utime.h and have not defined the
following function:

int utime(const char *, const struct utimbuf *);

Although the function called utimes, defined in sys/time.h exist.

int utimes(const char *path, const struct timeval times[2]);

In the method, in posixmodule.c:

static PyObject *
posix_utime(PyObject *self, PyObject *args);

usage of these methods are used. If a time is specified in args, a
define determines which of the two methods to use, utime or utimes
depending if these exist or not.

If Py_None is sent instead utime is always used, the solution to solve
this is to use #ifdef with HAVE_UTIMES.

Line number 2835 in

I have not checked if this is solved in future versions.
msg88471 - (view) Author: John Szakmeister (jszakmeister) * Date: 2009-05-28 10:07
It seems reasonable to prefer utimes() over utime() in all cases, when 
utimes() is available, since utime() is considered obsolete.  I've 
attached a patch with the required change and ran all the tests.  There 
are some tests failing on trunk with my system.  However this patch 
introduced no additional failures (test_posix passes).  BTW, the patch is 
against trunk.
msg221016 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-06-19 20:17
This is no longer an issue in Python3; there utimes is used if it is available (if utimensat is not).

Since this doesn't affect the platforms actually supported by python2.7, I'm closing this as out of date.
Date User Action Args
2022-04-11 14:56:36adminsetgithub: 47675
2014-06-19 20:17:18r.david.murraysetstatus: open -> closed

nosy: + r.david.murray
messages: + msg221016

resolution: out of date
stage: resolved
2010-08-03 20:56:12terry.reedysetversions: + Python 3.1, Python 2.7, Python 3.2, - Python 2.5
2009-05-28 10:07:42jszakmeistersetfiles: + issue-3425-utimes.patch

nosy: + jszakmeister
messages: + msg88471

keywords: + patch
2008-07-22 13:56:32oskar86create