comparison Python/import.c @ 16893:f1c8ea92ee85 legacy-trunk

Suppress a compiler warning under OpenVMS; time_t is unsigned on (at least) the more recent versions of that platform, so we use the value (time_t)(-1) as the error value. This is the type used in the OpenVMS documentation: http://www.openvms.compaq.com/commercial/c/5763p048.htm#inde This closes SF tracker bug #404240. Also clean up an exception message when detecting overflow of time_t values beyond 4 bytes.
author Fred Drake <fdrake@acm.org>
date Thu, 01 Mar 2001 06:33:32 +0000
parents 859829384663
children fa84f9f41092
comparison
equal deleted inserted replaced
16892:f27d3299df39 16893:f1c8ea92ee85
700 char *cpathname; 700 char *cpathname;
701 PyCodeObject *co; 701 PyCodeObject *co;
702 PyObject *m; 702 PyObject *m;
703 703
704 mtime = PyOS_GetLastModificationTime(pathname, fp); 704 mtime = PyOS_GetLastModificationTime(pathname, fp);
705 if (mtime == -1) 705 if (mtime == (time_t)(-1))
706 return NULL; 706 return NULL;
707 #if SIZEOF_TIME_T > 4 707 #if SIZEOF_TIME_T > 4
708 /* Python's .pyc timestamp handling presumes that the timestamp fits 708 /* Python's .pyc timestamp handling presumes that the timestamp fits
709 in 4 bytes. This will be fine until sometime in the year 2038, 709 in 4 bytes. This will be fine until sometime in the year 2038,
710 when a 4-byte signed time_t will overflow. 710 when a 4-byte signed time_t will overflow.
711 */ 711 */
712 if (mtime >> 32) { 712 if (mtime >> 32) {
713 PyErr_SetString(PyExc_OverflowError, 713 PyErr_SetString(PyExc_OverflowError,
714 "modification time overflows a 4 bytes"); 714 "modification time overflows a 4 byte field");
715 return NULL; 715 return NULL;
716 } 716 }
717 #endif 717 #endif
718 cpathname = make_compiled_pathname(pathname, buf, (size_t)MAXPATHLEN+1); 718 cpathname = make_compiled_pathname(pathname, buf, (size_t)MAXPATHLEN+1);
719 if (cpathname != NULL && 719 if (cpathname != NULL &&