[Python-checkins] gh-106320: Remove _PyOS_ReadlineTState API (#107034)
vstinner
webhook-mailer at python.org
Sat Jul 22 10:45:59 EDT 2023
https://github.com/python/cpython/commit/d228825e08883fc13f35eb91435f95d32524931c
commit: d228825e08883fc13f35eb91435f95d32524931c
branch: main
author: Victor Stinner <vstinner at python.org>
committer: vstinner <vstinner at python.org>
date: 2023-07-22T14:45:56Z
summary:
gh-106320: Remove _PyOS_ReadlineTState API (#107034)
Remove _PyOS_ReadlineTState variable from the public C API.
The symbol is still exported for the readline shared extension.
files:
M Include/cpython/pythonrun.h
M Modules/readline.c
M Parser/myreadline.c
diff --git a/Include/cpython/pythonrun.h b/Include/cpython/pythonrun.h
index fb61765537402..3b2537e01b83b 100644
--- a/Include/cpython/pythonrun.h
+++ b/Include/cpython/pythonrun.h
@@ -117,5 +117,4 @@ PyAPI_FUNC(PyObject *) PyRun_FileFlags(FILE *fp, const char *p, int s, PyObject
/* Stuff with no proper home (yet) */
PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, const char *);
-PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState;
PyAPI_DATA(char) *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, const char *);
diff --git a/Modules/readline.c b/Modules/readline.c
index a592919692cb8..6729a09cb0da5 100644
--- a/Modules/readline.c
+++ b/Modules/readline.c
@@ -1313,6 +1313,9 @@ rlhandler(char *text)
static char *
readline_until_enter_or_signal(const char *prompt, int *signal)
{
+ // Defined in Parser/myreadline.c
+ extern PyThreadState *_PyOS_ReadlineTState;
+
char * not_done_reading = "";
fd_set selectset;
diff --git a/Parser/myreadline.c b/Parser/myreadline.c
index 7074aba74b728..815387388218c 100644
--- a/Parser/myreadline.c
+++ b/Parser/myreadline.c
@@ -20,7 +20,9 @@
#endif /* MS_WINDOWS */
-PyThreadState* _PyOS_ReadlineTState = NULL;
+// Export the symbol since it's used by the readline shared extension
+PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState;
+PyThreadState *_PyOS_ReadlineTState = NULL;
static PyThread_type_lock _PyOS_ReadlineLock = NULL;
More information about the Python-checkins
mailing list