summaryrefslogtreecommitdiffstats
path: root/Python/import.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2006-03-07 12:08:51 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2006-03-07 12:08:51 (GMT)
commit725507b52ec40ab49ad87596fff7434322b9b5b1 (patch)
tree5b16b79a6810a7c2683db27ee9d34b10b270ae86 /Python/import.c
parent8eb8a829c1e4535be9d98b70875d5193f6b94737 (diff)
downloadcpython-725507b52ec40ab49ad87596fff7434322b9b5b1.zip
cpython-725507b52ec40ab49ad87596fff7434322b9b5b1.tar.gz
cpython-725507b52ec40ab49ad87596fff7434322b9b5b1.tar.bz2
Change int to Py_ssize_t in several places.
Add (int) casts to silence compiler warnings. Raise Python exceptions for overflows.
Diffstat (limited to 'Python/import.c')
-rw-r--r--Python/import.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Python/import.c b/Python/import.c
index 4aeeb3a..f214ed5 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -853,7 +853,7 @@ write_compiled_module(PyCodeObject *co, char *cpathname, time_t mtime)
/* 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 @@ get_path_importer(PyObject *path_importer_cache, PyObject *path_hooks,
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 @@ static struct filedescr *
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 @@ get_parent(PyObject *globals, char *buf, Py_ssize_t *p_buflen, int level)
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");