Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1418)

Unified Diff: Python/pythonrun.c

Issue 8070: Infinite loop in PyRun_InteractiveLoopFlags() if PyRun_InteractiveOneFlags() raises an error
Patch Set: Created 1 year, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Misc/NEWS ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Python/pythonrun.c Sun Mar 11 19:33:29 2012 +0100
+++ b/Python/pythonrun.c Sun Mar 11 19:26:14 2012 -0700
@@ -1107,10 +1107,8 @@
PRINT_TOTAL_REFS();
if (ret == E_EOF)
return 0;
- /*
- if (ret == E_NOMEM)
- return -1;
- */
+ else if (ret != 0)
+ return ret;
}
}
@@ -1144,19 +1142,22 @@
PyObject *m, *d, *v, *w, *oenc = NULL;
mod_ty mod;
PyArena *arena;
- char *ps1 = "", *ps2 = "", *enc = NULL;
+ char *ps1 = "", *ps2 = "";
+ const char *enc = NULL;
int errcode = 0;
_Py_IDENTIFIER(encoding);
if (fp == stdin) {
/* Fetch encoding from sys.stdin */
v = PySys_GetObject("stdin");
- if (v == NULL || v == Py_None)
- return -1;
- oenc = _PyObject_GetAttrId(v, &PyId_encoding);
- if (!oenc)
- return -1;
- enc = _PyUnicode_AsString(oenc);
+ if (v == NULL || v == Py_None)
+ enc = Py_FileSystemDefaultEncoding;
+ else {
+ oenc = _PyObject_GetAttrId(v, &PyId_encoding);
+ if (!oenc)
+ return -1;
+ enc = _PyUnicode_AsString(oenc);
+ }
if (enc == NULL)
return -1;
}
« no previous file with comments | « Misc/NEWS ('k') | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld cbc36f91f3f7