summaryrefslogtreecommitdiffstats
path: root/Python/errors.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/errors.c')
-rw-r--r--Python/errors.c4
1 files changed, 2 insertions, 2 deletions
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