From dfc087b884d2487421fb0241bd8abe3f5e0d4e88 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Fri, 9 Sep 2016 00:08:35 +0200 Subject: Check return value of PyList_Append() in Py_Main(). CID 1353200 --- Modules/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Modules/main.c') diff --git a/Modules/main.c b/Modules/main.c index b6dcdd0a30..0b82f480a6 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -482,7 +482,8 @@ Py_Main(int argc, wchar_t **argv) warning_option = PyUnicode_FromWideChar(_PyOS_optarg, -1); if (warning_option == NULL) Py_FatalError("failure in handling of -W argument"); - PyList_Append(warning_options, warning_option); + if (PyList_Append(warning_options, warning_option) == -1) + Py_FatalError("failure in handling of -W argument"); Py_DECREF(warning_option); break; -- cgit v1.2.1 From 8d9c31e48a0eda1a5f16fca31aebd970074fcd27 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Sat, 17 Sep 2016 12:22:41 -0700 Subject: Issue #28192: Don't import readline in isolated mode --- Modules/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Modules/main.c') diff --git a/Modules/main.c b/Modules/main.c index 0b82f480a6..6986d94b42 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -703,7 +703,8 @@ Py_Main(int argc, wchar_t **argv) PySys_SetArgv(argc-_PyOS_optind, argv+_PyOS_optind); if ((Py_InspectFlag || (command == NULL && filename == NULL && module == NULL)) && - isatty(fileno(stdin))) { + isatty(fileno(stdin)) && + !Py_IsolatedFlag) { PyObject *v; v = PyImport_ImportModule("readline"); if (v == NULL) -- cgit v1.2.1 From 457668cddd4cb03d8ae6865ec49c3d7ffe9a8da8 Mon Sep 17 00:00:00 2001 From: INADA Naoki Date: Mon, 21 Nov 2016 20:57:14 +0900 Subject: Issue #28532: Show sys.version when -V option is supplied twice --- Modules/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Modules/main.c') diff --git a/Modules/main.c b/Modules/main.c index 6986d94b42..d75f64a65f 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -74,6 +74,7 @@ static const char usage_3[] = "\ -v : verbose (trace import statements); also PYTHONVERBOSE=x\n\ can be supplied multiple times to increase verbosity\n\ -V : print the Python version number and exit (also --version)\n\ + when given twice, print more information about the build\n\ -W arg : warning control; arg is action:message:category:module:lineno\n\ also PYTHONWARNINGS=arg\n\ -x : skip first line of source, allowing use of non-Unix forms of #!cmd\n\ @@ -512,7 +513,7 @@ Py_Main(int argc, wchar_t **argv) return usage(0, argv[0]); if (version) { - printf("Python %s\n", PY_VERSION); + printf("Python %s\n", version >= 2 ? Py_GetVersion() : PY_VERSION); return 0; } -- cgit v1.2.1 From 6ed09e25a422f7eb9093c248769b763ca823c144 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Wed, 28 Dec 2016 15:41:09 -0800 Subject: Issue #28768: Fix implicit declaration of function _setmode. Patch by Masayuki Yamamoto --- Modules/main.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Modules/main.c') diff --git a/Modules/main.c b/Modules/main.c index d75f64a65f..4cbe376975 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -7,6 +7,9 @@ #if defined(MS_WINDOWS) || defined(__CYGWIN__) #include +#ifdef HAVE_IO_H +#include +#endif #ifdef HAVE_FCNTL_H #include #endif -- cgit v1.2.1