Mercurial > cpython-lru_cache-weakref
comparison Python/pythonrun.c @ 43632:0067a6ab4854
Issue 1267, continued.
Additional patch by Christian Heimes to deal more cleanly with the
FILE* vs file-descriptor issues.
I cleaned up his code a bit, and moved the lseek() call into import.c.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Mon, 22 Oct 2007 00:09:51 +0000 |
| parents | a2bb76d11d66 |
| children | 00b136b7da84 |
comparison
equal
deleted
inserted
replaced
| 43622:8fe226931ee7 | 43632:0067a6ab4854 |
|---|---|
| 717 if (PyObject_SetAttrString(bimod, "open", wrapper) == -1) { | 717 if (PyObject_SetAttrString(bimod, "open", wrapper) == -1) { |
| 718 goto error; | 718 goto error; |
| 719 } | 719 } |
| 720 | 720 |
| 721 /* Set sys.stdin */ | 721 /* Set sys.stdin */ |
| 722 if (!(std = PyFile_FromFileEx(stdin, "<stdin>", "r", fclose, -1, | 722 if (!(std = PyFile_FromFd(fileno(stdin), "<stdin>", "r", -1, |
| 723 NULL, "\n"))) { | 723 NULL, "\n"))) { |
| 724 goto error; | 724 goto error; |
| 725 } | 725 } |
| 726 PySys_SetObject("__stdin__", std); | 726 PySys_SetObject("__stdin__", std); |
| 727 PySys_SetObject("stdin", std); | 727 PySys_SetObject("stdin", std); |
| 728 Py_DECREF(std); | 728 Py_DECREF(std); |
| 729 | 729 |
| 730 /* Set sys.stdout */ | 730 /* Set sys.stdout */ |
| 731 if (!(std = PyFile_FromFileEx(stdout, "<stdout>", "w", fclose, -1, | 731 if (!(std = PyFile_FromFd(fileno(stdout), "<stdout>", "w", -1, |
| 732 NULL, "\n"))) { | 732 NULL, "\n"))) { |
| 733 goto error; | 733 goto error; |
| 734 } | 734 } |
| 735 PySys_SetObject("__stdout__", std); | 735 PySys_SetObject("__stdout__", std); |
| 736 PySys_SetObject("stdout", std); | 736 PySys_SetObject("stdout", std); |
| 737 Py_DECREF(std); | 737 Py_DECREF(std); |
| 738 | 738 |
| 739 /* Set sys.stderr */ | 739 /* Set sys.stderr */ |
| 740 if (!(std = PyFile_FromFileEx(stderr, "<stderr>", "w", fclose, -1, | 740 if (!(std = PyFile_FromFd(fileno(stderr), "<stderr>", "w", -1, |
| 741 NULL, "\n"))) { | 741 NULL, "\n"))) { |
| 742 goto error; | 742 goto error; |
| 743 } | 743 } |
| 744 PySys_SetObject("__stderr__", std); | 744 PySys_SetObject("__stderr__", std); |
| 745 PySys_SetObject("stderr", std); | 745 PySys_SetObject("stderr", std); |
