Mercurial > cpython-lru_cache-weakref
diff Python/import.c @ 36866:9eb24f92a784 legacy-trunk
Change int to Py_ssize_t in several places.
Add (int) casts to silence compiler warnings.
Raise Python exceptions for overflows.
| author | Martin v. Löwis <martin@v.loewis.de> |
|---|---|
| date | Tue, 07 Mar 2006 12:08:51 +0000 |
| parents | 5c36c222e7ca |
| children | fc10ff322df1 |
line wrap: on
line diff
--- a/Python/import.c Tue Mar 07 11:58:50 2006 +0000 +++ b/Python/import.c Tue Mar 07 12:08:51 2006 +0000 @@ -853,7 +853,7 @@ /* Now write the true mtime */ fseek(fp, 4L, 0); assert(mtime < LONG_MAX); - PyMarshal_WriteLongToFile(mtime, fp, Py_MARSHAL_VERSION); + PyMarshal_WriteLongToFile((long)mtime, fp, Py_MARSHAL_VERSION); fflush(fp); fclose(fp); if (Py_VerboseFlag) @@ -1016,7 +1016,7 @@ PyObject *p) { PyObject *importer; - int j, nhooks; + Py_ssize_t j, nhooks; /* These conditions are the caller's responsibility: */ assert(PyList_Check(path_hooks)); @@ -1075,7 +1075,7 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf, size_t buflen, FILE **p_fp, PyObject **p_loader) { - int i, npath; + Py_ssize_t i, npath; size_t len, namelen; struct filedescr *fdp = NULL; char *filemode; @@ -2028,7 +2028,7 @@ modpath = PyDict_GetItem(globals, pathstr); if (modpath != NULL) { - int len = PyString_GET_SIZE(modname); + Py_ssize_t len = PyString_GET_SIZE(modname); if (len > MAXPATHLEN) { PyErr_SetString(PyExc_ValueError, "Module name too long");
