diff options
Diffstat (limited to 'Python')
-rw-r--r-- | Python/bltinmodule.c | 2 | ||||
-rw-r--r-- | Python/errors.c | 4 | ||||
-rw-r--r-- | Python/import.c | 6 | ||||
-rw-r--r-- | Python/traceback.c | 6 |
4 files changed, 9 insertions, 9 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 35536d9..680152d 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -594,7 +594,7 @@ builtin_execfile(PyObject *self, PyObject *args) if (exists) { Py_BEGIN_ALLOW_THREADS - fp = fopen(filename, "r"); + fp = fopen(filename, "r" PY_STDIOTEXTMODE); Py_END_ALLOW_THREADS if (fp == NULL) { diff --git a/Python/errors.c b/Python/errors.c index 3869b1c..265e5bb 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -646,14 +646,14 @@ PyErr_ProgramText(char *filename, int lineno) if (filename == NULL || lineno <= 0) return NULL; - fp = fopen(filename, "r"); + fp = fopen(filename, "r" PY_STDIOTEXTMODE); if (fp == NULL) return NULL; for (i = 0; i < lineno; i++) { char *pLastChar = &linebuf[sizeof(linebuf) - 2]; do { *pLastChar = '\0'; - if (fgets(linebuf, sizeof linebuf, fp) == NULL) + if (Py_UniversalNewlineFgets(linebuf, sizeof linebuf, fp, NULL) == NULL) break; /* fgets read *something*; if it didn't get as far as pLastChar, it must have found a newline diff --git a/Python/import.c b/Python/import.c index 3c87506..3775f88 100644 --- a/Python/import.c +++ b/Python/import.c @@ -81,15 +81,15 @@ struct filedescr * _PyImport_Filetab = NULL; #ifdef RISCOS static const struct filedescr _PyImport_StandardFiletab[] = { - {"/py", "r", PY_SOURCE}, + {"/py", "r" PY_STDIOTEXTMODE, PY_SOURCE}, {"/pyc", "rb", PY_COMPILED}, {0, 0} }; #else static const struct filedescr _PyImport_StandardFiletab[] = { - {".py", "r", PY_SOURCE}, + {".py", "r" PY_STDIOTEXTMODE, PY_SOURCE}, #ifdef MS_WIN32 - {".pyw", "r", PY_SOURCE}, + {".pyw", "r" PY_STDIOTEXTMODE, PY_SOURCE}, #endif {".pyc", "rb", PY_COMPILED}, {0, 0} diff --git a/Python/traceback.c b/Python/traceback.c index 52f3202..de918f9 100644 --- a/Python/traceback.c +++ b/Python/traceback.c @@ -155,7 +155,7 @@ tb_displayline(PyObject *f, char *filename, int lineno, char *name) /* This is needed by Emacs' compile command */ #define FMT " File \"%.500s\", line %d, in %.500s\n" #endif - xfp = fopen(filename, "r"); + xfp = fopen(filename, "r" PY_STDIOTEXTMODE); if (xfp == NULL) { /* Search tail of filename in sys.path before giving up */ PyObject *path; @@ -186,7 +186,7 @@ tb_displayline(PyObject *f, char *filename, int lineno, char *name) if (len > 0 && namebuf[len-1] != SEP) namebuf[len++] = SEP; strcpy(namebuf+len, tail); - xfp = fopen(namebuf, "r"); + xfp = fopen(namebuf, "r" PY_STDIOTEXTMODE); if (xfp != NULL) { filename = namebuf; break; @@ -203,7 +203,7 @@ tb_displayline(PyObject *f, char *filename, int lineno, char *name) char* pLastChar = &linebuf[sizeof(linebuf)-2]; do { *pLastChar = '\0'; - if (fgets(linebuf, sizeof linebuf, xfp) == NULL) + if (Py_UniversalNewlineFgets(linebuf, sizeof linebuf, xfp, NULL) == NULL) break; /* fgets read *something*; if it didn't get as far as pLastChar, it must have found a newline |