Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b6987b1

Browse files
committed
Alas, get rid of the Win specific hack to ask the user to press Return
before exiting when an error happened. This didn't work right when Python is invoked from a daemon.
1 parent a99c5db commit b6987b1

1 file changed

Lines changed: 0 additions & 47 deletions

File tree

Python/pythonrun.c

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ Py_IsInitialized()
101101
102102
*/
103103

104-
extern void win_pre_init(), win_pre_exit();
105104
void
106105
Py_Initialize()
107106
{
@@ -113,9 +112,6 @@ Py_Initialize()
113112
if (initialized)
114113
return;
115114
initialized = 1;
116-
#ifdef MS_WINDOWS
117-
win_pre_init();
118-
#endif
119115

120116
if ((p = getenv("PYTHONDEBUG")) && *p != '\0')
121117
Py_DebugFlag = 1;
@@ -1102,9 +1098,6 @@ Py_Exit(sts)
11021098
#ifdef macintosh
11031099
PyMac_Exit(sts);
11041100
#else
1105-
#ifdef MS_WINDOWS
1106-
win_pre_exit(sts);
1107-
#endif
11081101
exit(sts);
11091102
#endif
11101103
}
@@ -1169,43 +1162,3 @@ Py_FdIsInteractive(fp, filename)
11691162
(strcmp(filename, "<stdin>") == 0) ||
11701163
(strcmp(filename, "???") == 0);
11711164
}
1172-
1173-
#ifdef MS_WINDOWS
1174-
1175-
#include <windows.h>
1176-
#include <conio.h>
1177-
1178-
static int its_my_console = -1;
1179-
1180-
static void
1181-
win_pre_init()
1182-
{
1183-
HANDLE console;
1184-
CONSOLE_SCREEN_BUFFER_INFO info;
1185-
if (its_my_console >= 0)
1186-
return;
1187-
its_my_console = 0;
1188-
console = GetStdHandle(STD_OUTPUT_HANDLE);
1189-
if (console == INVALID_HANDLE_VALUE)
1190-
return;
1191-
if (!GetConsoleScreenBufferInfo(console, &info)) {
1192-
return;
1193-
}
1194-
if (info.dwCursorPosition.Y == 0)
1195-
its_my_console = 1;
1196-
}
1197-
1198-
static void
1199-
win_pre_exit(sts)
1200-
int sts;
1201-
{
1202-
if (sts == 0)
1203-
return;
1204-
if (its_my_console <= 0)
1205-
return;
1206-
fprintf(stderr, "Hit any key to exit...");
1207-
fflush(stderr);
1208-
_getch();
1209-
}
1210-
1211-
#endif

0 commit comments

Comments
 (0)