summaryrefslogtreecommitdiff
path: root/Python
diff options
context:
space:
mode:
authortzickel <tzickel@users.noreply.github.com>2018-09-10 21:46:14 +0300
committerPetr Viktorin <encukou@gmail.com>2018-09-10 11:46:14 -0700
commitf64c813de84011a84ca21d75a294861a9cc2dfdc (patch)
tree80cecd0ba567158bcb642a1283a28189f18b5713 /Python
parented62e645101fdd83aee519f6f33a4384ff79f105 (diff)
downloadcpython-git-f64c813de84011a84ca21d75a294861a9cc2dfdc.tar.gz
bpo-25083: Python can sometimes create incorrect .pyc files (GH-8449)
Python 2 never checked for I/O error when reading .py files and thus could mistake an I/O error for EOF and create incorrect .pyc files. This adds an check for this and aborts on an error.
Diffstat (limited to 'Python')
-rw-r--r--Python/pythonrun.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 5707c9f524..2c9f55fbd1 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -1654,6 +1654,9 @@ err_input(perrdetail *err)
Py_XDECREF(tb);
break;
}
+ case E_IO:
+ msg = "I/O error while reading";
+ break;
case E_LINECONT:
msg = "unexpected character after line continuation character";
break;