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

Side by Side Diff: Python/pythonrun.c

Issue 767: [issue2630] repr() should not escape non-ASCII characters (Closed) SVN Base: http://svn.python.org/view/*checkout*/python/branches/py3k/
Patch Set: Created 1 year, 7 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 unified diff | Download patch
OLDNEW
1 1
2 /* Python interpreter top-level routines, including init/exit */ 2 /* Python interpreter top-level routines, including init/exit */
3 3
4 #include "Python.h" 4 #include "Python.h"
5 5
6 #include "Python-ast.h" 6 #include "Python-ast.h"
7 #undef Yield /* undefine macro conflicting with winbase.h */ 7 #undef Yield /* undefine macro conflicting with winbase.h */
8 #include "grammar.h" 8 #include "grammar.h"
9 #include "node.h" 9 #include "node.h"
10 #include "token.h" 10 #include "token.h"
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 fd = fileno(stdout); 757 fd = fileno(stdout);
758 if (fd < 0) { 758 if (fd < 0) {
759 #ifdef MS_WINDOWS 759 #ifdef MS_WINDOWS
760 std = Py_None; 760 std = Py_None;
761 Py_INCREF(std); 761 Py_INCREF(std);
762 #else 762 #else
763 goto error; 763 goto error;
764 #endif 764 #endif
765 } 765 }
766 else { 766 else {
767 » » if (!(std = PyFile_FromFd(fd, "<stdout>", "w", -1, NULL, NULL, 767 » » if (!(std = PyFile_FromFd(fd, "<stdout>", "w", -1, NULL,
768 » » » » » "\n", 0))) { 768 » » » » » "backslashreplace", "\n", 0))) {
769 goto error; 769 goto error;
770 } 770 }
771 } /* if (fd < 0) */ 771 } /* if (fd < 0) */
772 PySys_SetObject("__stdout__", std); 772 PySys_SetObject("__stdout__", std);
773 PySys_SetObject("stdout", std); 773 PySys_SetObject("stdout", std);
774 Py_DECREF(std); 774 Py_DECREF(std);
775 775
776 #if 1 /* Disable this if you have trouble debugging bootstrap stuff */ 776 #if 1 /* Disable this if you have trouble debugging bootstrap stuff */
777 /* Set sys.stderr, replaces the preliminary stderr */ 777 /* Set sys.stderr, replaces the preliminary stderr */
778 fd = fileno(stderr); 778 fd = fileno(stderr);
779 if (fd < 0) { 779 if (fd < 0) {
780 #ifdef MS_WINDOWS 780 #ifdef MS_WINDOWS
781 std = Py_None; 781 std = Py_None;
782 Py_INCREF(std); 782 Py_INCREF(std);
783 #else 783 #else
784 goto error; 784 goto error;
785 #endif 785 #endif
786 } 786 }
787 else { 787 else {
788 » » if (!(std = PyFile_FromFd(fd, "<stderr>", "w", -1, NULL, NULL, 788 » » if (!(std = PyFile_FromFd(fd, "<stderr>", "w", -1, NULL,
789 » » » » » "\n", 0))) { 789 » » » » » "backslashreplace", "\n", 0))) {
790 goto error; 790 goto error;
791 } 791 }
792 } /* if (fd < 0) */ 792 } /* if (fd < 0) */
793 793
794 /* Same as hack above, pre-import stderr's codec to avoid recursion 794 /* Same as hack above, pre-import stderr's codec to avoid recursion
795 when import.c tries to write to stderr in verbose mode. */ 795 when import.c tries to write to stderr in verbose mode. */
796 encoding_attr = PyObject_GetAttrString(std, "encoding"); 796 encoding_attr = PyObject_GetAttrString(std, "encoding");
797 if (encoding_attr != NULL) { 797 if (encoding_attr != NULL) {
798 const char * encoding; 798 const char * encoding;
799 encoding = PyUnicode_AsString(encoding_attr); 799 encoding = PyUnicode_AsString(encoding_attr);
(...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after
2079 #undef PyRun_InteractiveLoop 2079 #undef PyRun_InteractiveLoop
2080 PyAPI_FUNC(int) 2080 PyAPI_FUNC(int)
2081 PyRun_InteractiveLoop(FILE *f, const char *p) 2081 PyRun_InteractiveLoop(FILE *f, const char *p)
2082 { 2082 {
2083 return PyRun_InteractiveLoopFlags(f, p, NULL); 2083 return PyRun_InteractiveLoopFlags(f, p, NULL);
2084 } 2084 }
2085 2085
2086 #ifdef __cplusplus 2086 #ifdef __cplusplus
2087 } 2087 }
2088 #endif 2088 #endif
OLDNEW

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld r497