Mercurial > cpython-lru_cache-weakref
comparison Python/sysmodule.c @ 34509:6f2dd081fe05 2.3
Partially revert #1074011; don't try to fflush stdin.
| author | Martin v. Löwis <martin@v.loewis.de> |
|---|---|
| date | Thu, 27 Jan 2005 18:55:06 +0000 |
| parents | 8c9e3ed594fe |
| children |
comparison
equal
deleted
inserted
replaced
| 34505:2639b10daa98 | 34509:6f2dd081fe05 |
|---|---|
| 914 #endif | 914 #endif |
| 915 | 915 |
| 916 m = Py_InitModule3("sys", sys_methods, sys_doc); | 916 m = Py_InitModule3("sys", sys_methods, sys_doc); |
| 917 sysdict = PyModule_GetDict(m); | 917 sysdict = PyModule_GetDict(m); |
| 918 | 918 |
| 919 sysin = PyFile_FromFile(stdin, "<stdin>", "r", _check_and_flush); | 919 /* Closing the standard FILE* if sys.std* goes aways causes problems |
| 920 * for embedded Python usages. Closing them when somebody explicitly | |
| 921 * invokes .close() might be possible, but the FAQ promises they get | |
| 922 * never closed. However, we still need to get write errors when | |
| 923 * writing fails (e.g. because stdout is redirected), so we flush the | |
| 924 * streams and check for errors before the file objects are deleted. | |
| 925 * On OS X, fflush()ing stdin causes an error, so we exempt stdin | |
| 926 * from that procedure. | |
| 927 */ | |
| 928 sysin = PyFile_FromFile(stdin, "<stdin>", "r", NULL); | |
| 920 sysout = PyFile_FromFile(stdout, "<stdout>", "w", _check_and_flush); | 929 sysout = PyFile_FromFile(stdout, "<stdout>", "w", _check_and_flush); |
| 921 syserr = PyFile_FromFile(stderr, "<stderr>", "w", _check_and_flush); | 930 syserr = PyFile_FromFile(stderr, "<stderr>", "w", _check_and_flush); |
| 922 if (PyErr_Occurred()) | 931 if (PyErr_Occurred()) |
| 923 return NULL; | 932 return NULL; |
| 924 #ifdef MS_WINDOWS | 933 #ifdef MS_WINDOWS |
