summaryrefslogtreecommitdiff
path: root/Parser/myreadline.c
diff options
context:
space:
mode:
authorAntoine Pitrou <pitrou@free.fr>2017-09-07 18:56:24 +0200
committerVictor Stinner <victor.stinner@gmail.com>2017-09-07 18:56:24 +0200
commita6a4dc816d68df04a7d592e0b6af8c7ecc4d4344 (patch)
tree1c31738009bee903417cea928e705a112aea2392 /Parser/myreadline.c
parent1f06a680de465be0c24a78ea3b610053955daa99 (diff)
downloadcpython-git-a6a4dc816d68df04a7d592e0b6af8c7ecc4d4344.tar.gz
bpo-31370: Remove support for threads-less builds (#3385)
* Remove Setup.config * Always define WITH_THREAD for compatibility.
Diffstat (limited to 'Parser/myreadline.c')
-rw-r--r--Parser/myreadline.c20
1 files changed, 0 insertions, 20 deletions
diff --git a/Parser/myreadline.c b/Parser/myreadline.c
index 9f3c2e343c..1b63f7863f 100644
--- a/Parser/myreadline.c
+++ b/Parser/myreadline.c
@@ -18,10 +18,8 @@
PyThreadState* _PyOS_ReadlineTState;
-#ifdef WITH_THREAD
#include "pythread.h"
static PyThread_type_lock _PyOS_ReadlineLock = NULL;
-#endif
int (*PyOS_InputHook)(void) = NULL;
@@ -77,13 +75,9 @@ my_fgets(char *buf, int len, FILE *fp)
#ifdef EINTR
if (err == EINTR) {
int s;
-#ifdef WITH_THREAD
PyEval_RestoreThread(_PyOS_ReadlineTState);
-#endif
s = PyErr_CheckSignals();
-#ifdef WITH_THREAD
PyEval_SaveThread();
-#endif
if (s < 0)
return 1;
/* try again */
@@ -133,13 +127,9 @@ _PyOS_WindowsConsoleReadline(HANDLE hStdIn)
if (WaitForSingleObjectEx(hInterruptEvent, 100, FALSE)
== WAIT_OBJECT_0) {
ResetEvent(hInterruptEvent);
-#ifdef WITH_THREAD
PyEval_RestoreThread(_PyOS_ReadlineTState);
-#endif
s = PyErr_CheckSignals();
-#ifdef WITH_THREAD
PyEval_SaveThread();
-#endif
if (s < 0)
goto exit;
}
@@ -178,13 +168,9 @@ exit:
PyMem_RawFree(wbuf);
if (err) {
-#ifdef WITH_THREAD
PyEval_RestoreThread(_PyOS_ReadlineTState);
-#endif
PyErr_SetFromWindowsErr(err);
-#ifdef WITH_THREAD
PyEval_SaveThread();
-#endif
}
return buf;
@@ -319,17 +305,13 @@ PyOS_Readline(FILE *sys_stdin, FILE *sys_stdout, const char *prompt)
PyOS_ReadlineFunctionPointer = PyOS_StdioReadline;
}
-#ifdef WITH_THREAD
if (_PyOS_ReadlineLock == NULL) {
_PyOS_ReadlineLock = PyThread_allocate_lock();
}
-#endif
_PyOS_ReadlineTState = PyThreadState_GET();
Py_BEGIN_ALLOW_THREADS
-#ifdef WITH_THREAD
PyThread_acquire_lock(_PyOS_ReadlineLock, 1);
-#endif
/* This is needed to handle the unlikely case that the
* interpreter is in interactive mode *and* stdin/out are not
@@ -343,9 +325,7 @@ PyOS_Readline(FILE *sys_stdin, FILE *sys_stdout, const char *prompt)
prompt);
Py_END_ALLOW_THREADS
-#ifdef WITH_THREAD
PyThread_release_lock(_PyOS_ReadlineLock);
-#endif
_PyOS_ReadlineTState = NULL;