summaryrefslogtreecommitdiff
path: root/Python/traceback.c
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2002-04-14 20:12:41 +0000
committerJack Jansen <jack.jansen@cwi.nl>2002-04-14 20:12:41 +0000
commit7b8c7546ebc1fc3688ef95768fa8b82f0f205490 (patch)
tree2e14b243347a9c38c82e2e774d4b201f23149916 /Python/traceback.c
parentdcd2dc2fffce8614c5d2b8d303a303a599b88a23 (diff)
downloadcpython-git-7b8c7546ebc1fc3688ef95768fa8b82f0f205490.tar.gz
Mass checkin of universal newline support.
Highlights: import and friends will understand any of \r, \n and \r\n as end of line. Python file input will do the same if you use mode 'U'. Everything can be disabled by configuring with --without-universal-newlines. See PEP278 for details.
Diffstat (limited to 'Python/traceback.c')
-rw-r--r--Python/traceback.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Python/traceback.c b/Python/traceback.c
index 52f3202ad5..de918f9a20 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