| --- 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; |
| } |