classification
Title: posixmodule.c always using res = utime(path, NULL)
Type: compile error Stage:
Components: Extension Modules Versions: Python 3.2, Python 3.1, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: jszakmeister, oskar86
Priority: normal Keywords: patch

Created on 2008-07-22 13:56 by oskar86, last changed 2010-08-03 20:56 by terry.reedy.

Files
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 (2)
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
http://svn.python.org/projects/python/trunk/Modules/posixmodule.c

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.
History
Date User Action Args
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