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

Delta Between Two Patch Sets: Modules/main.c

Issue 11681: -b option undocumented
Left Patch Set: Created 5 years, 5 months ago
Right Patch Set: Created 2 years, 10 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« Doc/using/cmdline.rst ('K') | « Doc/using/cmdline.rst ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* Python interpreter main program */ 1 /* Python interpreter main program */
2 2
3 #include "Python.h" 3 #include "Python.h"
4 #include "osdefs.h" 4 #include "osdefs.h"
5 #include "code.h" /* For CO_FUTURE_DIVISION */ 5 #include "code.h" /* For CO_FUTURE_DIVISION */
6 #include "import.h" 6 #include "import.h"
7 7
8 #ifdef __VMS 8 #ifdef __VMS
9 #include <unixlib.h> 9 #include <unixlib.h>
10 #endif 10 #endif
11 11
12 #if defined(MS_WINDOWS) || defined(__CYGWIN__) 12 #if defined(MS_WINDOWS) || defined(__CYGWIN__)
13 #ifdef HAVE_IO_H
14 #include <io.h>
15 #endif
13 #ifdef HAVE_FCNTL_H 16 #ifdef HAVE_FCNTL_H
14 #include <fcntl.h> 17 #include <fcntl.h>
15 #endif 18 #endif
16 #endif 19 #endif
17 20
18 #if (defined(PYOS_OS2) && !defined(PYCC_GCC)) || defined(MS_WINDOWS) 21 #if (defined(PYOS_OS2) && !defined(PYCC_GCC)) || defined(MS_WINDOWS)
19 #define PYTHONHOMEHELP "<prefix>\\lib" 22 #define PYTHONHOMEHELP "<prefix>\\lib"
20 #else 23 #else
21 #if defined(PYOS_OS2) && defined(PYCC_GCC) 24 #if defined(PYOS_OS2) && defined(PYCC_GCC)
22 #define PYTHONHOMEHELP "<prefix>/Lib" 25 #define PYTHONHOMEHELP "<prefix>/Lib"
(...skipping 29 matching lines...) Expand all
52 extern int Py_RISCOSWimpFlag; 55 extern int Py_RISCOSWimpFlag;
53 #endif /*RISCOS*/ 56 #endif /*RISCOS*/
54 57
55 /* Short usage message (with %s for argv0) */ 58 /* Short usage message (with %s for argv0) */
56 static char *usage_line = 59 static char *usage_line =
57 "usage: %s [option] ... [-c cmd | -m mod | file | -] [arg] ...\n"; 60 "usage: %s [option] ... [-c cmd | -m mod | file | -] [arg] ...\n";
58 61
59 /* Long usage message, split into parts < 512 bytes */ 62 /* Long usage message, split into parts < 512 bytes */
60 static char *usage_1 = "\ 63 static char *usage_1 = "\
61 Options and arguments (and corresponding environment variables):\n\ 64 Options and arguments (and corresponding environment variables):\n\
62 -b : issue warnings about str(bytes_instance), str(bytearray_instance)\n\ 65 -b : issue warnings about comparing bytearray with unicode\n\
63 and comparing bytes/bytearray with str. (-bb: issue errors)\n\ 66 (-bb: issue errors)\n\
64 -B : don't write .py[co] files on import; also PYTHONDONTWRITEBYTECODE=x\n\ 67 -B : don't write .py[co] files on import; also PYTHONDONTWRITEBYTECODE=x\n\
65 -c cmd : program passed in as string (terminates option list)\n\ 68 -c cmd : program passed in as string (terminates option list)\n\
66 -d : debug output from parser; also PYTHONDEBUG=x\n\ 69 -d : debug output from parser; also PYTHONDEBUG=x\n\
67 -E : ignore PYTHON* environment variables (such as PYTHONPATH)\n\ 70 -E : ignore PYTHON* environment variables (such as PYTHONPATH)\n\
68 -h : print this help message and exit (also --help)\n\ 71 -h : print this help message and exit (also --help)\n\
69 -i : inspect interactively after running script; forces a prompt even\n\ 72 -i : inspect interactively after running script; forces a prompt even\n\
70 "; 73 ";
71 static char *usage_2 = "\ 74 static char *usage_2 = "\
72 if stdin does not appear to be a terminal; also PYTHONINSPECT=x\n\ 75 if stdin does not appear to be a terminal; also PYTHONINSPECT=x\n\
73 -m mod : run library module as a script (terminates option list)\n\ 76 -m mod : run library module as a script (terminates option list)\n\
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 151
149 static void RunStartupFile(PyCompilerFlags *cf) 152 static void RunStartupFile(PyCompilerFlags *cf)
150 { 153 {
151 char *startup = Py_GETENV("PYTHONSTARTUP"); 154 char *startup = Py_GETENV("PYTHONSTARTUP");
152 if (startup != NULL && startup[0] != '\0') { 155 if (startup != NULL && startup[0] != '\0') {
153 FILE *fp = fopen(startup, "r"); 156 FILE *fp = fopen(startup, "r");
154 if (fp != NULL) { 157 if (fp != NULL) {
155 (void) PyRun_SimpleFileExFlags(fp, startup, 0, cf); 158 (void) PyRun_SimpleFileExFlags(fp, startup, 0, cf);
156 PyErr_Clear(); 159 PyErr_Clear();
157 fclose(fp); 160 fclose(fp);
158 } else { 161 } else {
159 int save_errno; 162 int save_errno;
160 save_errno = errno; 163 save_errno = errno;
161 PySys_WriteStderr("Could not open PYTHONSTARTUP\n"); 164 PySys_WriteStderr("Could not open PYTHONSTARTUP\n");
162 errno = save_errno; 165 errno = save_errno;
163 PyErr_SetFromErrnoWithFilename(PyExc_IOError, 166 PyErr_SetFromErrnoWithFilename(PyExc_IOError,
164 startup); 167 startup);
165 PyErr_Print(); 168 PyErr_Print();
166 PyErr_Clear(); 169 PyErr_Clear();
167 } 170 }
168 } 171 }
169 } 172 }
170 173
171 174
172 static int RunModule(char *module, int set_argv0) 175 static int RunModule(char *module, int set_argv0)
173 { 176 {
174 PyObject *runpy, *runmodule, *runargs, *result; 177 PyObject *runpy, *runmodule, *runargs, *result;
175 runpy = PyImport_ImportModule("runpy"); 178 runpy = PyImport_ImportModule("runpy");
176 if (runpy == NULL) { 179 if (runpy == NULL) {
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 Py_GetArgcArgv(int *argc, char ***argv) 700 Py_GetArgcArgv(int *argc, char ***argv)
698 { 701 {
699 *argc = orig_argc; 702 *argc = orig_argc;
700 *argv = orig_argv; 703 *argv = orig_argv;
701 } 704 }
702 705
703 #ifdef __cplusplus 706 #ifdef __cplusplus
704 } 707 }
705 #endif 708 #endif
706 709
LEFTRIGHT

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+