Index: Modules/posixmodule.c =================================================================== --- Modules/posixmodule.c (révision 79528) +++ Modules/posixmodule.c (copie de travail) @@ -858,18 +858,18 @@ int st_gid; int st_rdev; __int64 st_size; - int st_atime; + time_t st_atime; int st_atime_nsec; - int st_mtime; + time_t st_mtime; int st_mtime_nsec; - int st_ctime; + time_t st_ctime; int st_ctime_nsec; }; static __int64 secs_between_epochs = 11644473600; /* Seconds between 1.1.1601 and 1.1.1970 */ static void -FILE_TIME_to_time_t_nsec(FILETIME *in_ptr, int *time_out, int* nsec_out) +FILE_TIME_to_time_t_nsec(FILETIME *in_ptr, time_t *time_out, int* nsec_out) { /* XXX endianness. Shouldn't matter, as all Windows implementations are little-endian */ /* Cannot simply cast and dereference in_ptr, @@ -877,12 +877,11 @@ __int64 in; memcpy(&in, in_ptr, sizeof(in)); *nsec_out = (int)(in % 10000000) * 100; /* FILETIME is in units of 100 nsec. */ - /* XXX Win32 supports time stamps past 2038; we currently don't */ - *time_out = Py_SAFE_DOWNCAST((in / 10000000) - secs_between_epochs, __int64, int); + *time_out = Py_SAFE_DOWNCAST((in / 10000000) - secs_between_epochs, __int64, time_t); } static void -time_t_to_FILE_TIME(int time_in, int nsec_in, FILETIME *out_ptr) +time_t_to_FILE_TIME(time_t time_in, int nsec_in, FILETIME *out_ptr) { /* XXX endianness */ __int64 out; @@ -2695,15 +2694,19 @@ #endif /* HAVE_UNAME */ static int -extract_time(PyObject *t, long* sec, long* usec) +extract_time(PyObject *t, time_t* sec, long* usec) { - long intval; + time_t intval; if (PyFloat_Check(t)) { double tval = PyFloat_AsDouble(t); - PyObject *intobj = Py_TYPE(t)->tp_as_number->nb_int(t); + PyObject *intobj = PyNumber_Int(t); if (!intobj) return -1; +#if SIZEOF_TIME_T > SIZEOF_LONG + intval = PyInt_AsUnsignedLongLongMask(intobj); +#else intval = PyInt_AsLong(intobj); +#endif Py_DECREF(intobj); if (intval == -1 && PyErr_Occurred()) return -1; @@ -2715,12 +2718,16 @@ *usec = 0; return 0; } +#if SIZEOF_TIME_T > SIZEOF_LONG + intval = PyInt_AsUnsignedLongLongMask(t); +#else intval = PyInt_AsLong(t); +#endif if (intval == -1 && PyErr_Occurred()) return -1; *sec = intval; *usec = 0; - return 0; + return 0; } PyDoc_STRVAR(posix_utime__doc__, @@ -2738,7 +2745,8 @@ wchar_t *wpath = NULL; char *apath = NULL; HANDLE hFile; - long atimesec, mtimesec, ausec, musec; + time_t atimesec, mtimesec; + long ausec, musec; FILETIME atime, mtime; PyObject *result = NULL; @@ -2812,7 +2820,8 @@ #else /* MS_WINDOWS */ char *path = NULL; - long atime, mtime, ausec, musec; + time_t atime, mtime; + long ausec, musec; int res; PyObject* arg;