Mercurial > cpython-lru_cache-weakref
comparison Python/pythonrun.c @ 83552:97522b189c79
merge 3.3 (#17863)
| author | Benjamin Peterson <benjamin@python.org> |
|---|---|
| date | Mon, 29 Apr 2013 10:23:31 -0400 |
| parents | 6eacc6c134a5 68d1ac152b5d |
| children | e39a8f8ceb9f |
comparison
equal
deleted
inserted
replaced
| 83550:393723b646a4 | 83552:97522b189c79 |
|---|---|
| 1253 char *ps1 = "", *ps2 = "", *enc = NULL; | 1253 char *ps1 = "", *ps2 = "", *enc = NULL; |
| 1254 int errcode = 0; | 1254 int errcode = 0; |
| 1255 _Py_IDENTIFIER(encoding); | 1255 _Py_IDENTIFIER(encoding); |
| 1256 | 1256 |
| 1257 if (fp == stdin) { | 1257 if (fp == stdin) { |
| 1258 /* Fetch encoding from sys.stdin */ | 1258 /* Fetch encoding from sys.stdin if possible. */ |
| 1259 v = PySys_GetObject("stdin"); | 1259 v = PySys_GetObject("stdin"); |
| 1260 if (v == NULL || v == Py_None) | 1260 if (v && v != Py_None) { |
| 1261 return -1; | 1261 oenc = _PyObject_GetAttrId(v, &PyId_encoding); |
| 1262 oenc = _PyObject_GetAttrId(v, &PyId_encoding); | 1262 if (oenc) |
| 1263 if (!oenc) | 1263 enc = _PyUnicode_AsString(oenc); |
| 1264 return -1; | 1264 if (!enc) |
| 1265 enc = _PyUnicode_AsString(oenc); | 1265 PyErr_Clear(); |
| 1266 if (enc == NULL) | 1266 } |
| 1267 return -1; | |
| 1268 } | 1267 } |
| 1269 v = PySys_GetObject("ps1"); | 1268 v = PySys_GetObject("ps1"); |
| 1270 if (v != NULL) { | 1269 if (v != NULL) { |
| 1271 v = PyObject_Str(v); | 1270 v = PyObject_Str(v); |
| 1272 if (v == NULL) | 1271 if (v == NULL) |
