]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-106320: Remove _PyOS_ReadlineTState API (#107034)
authorVictor Stinner <vstinner@python.org>
Sat, 22 Jul 2023 14:45:56 +0000 (16:45 +0200)
committerGitHub <noreply@github.com>
Sat, 22 Jul 2023 14:45:56 +0000 (14:45 +0000)
Remove _PyOS_ReadlineTState variable from the public C API.
The symbol is still exported for the readline shared extension.

Include/cpython/pythonrun.h
Modules/readline.c
Parser/myreadline.c

index fb6176553740268e654c478a64977fb7093849d9..3b2537e01b83b1b83214f734375efa1a77aa914d 100644 (file)
@@ -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 *);
index a592919692cb8363217e9039ccdcc62f7430e011..6729a09cb0da5ea9bfc8a2d451113e4300ec2d65 100644 (file)
@@ -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;
 
index 7074aba74b728c818dc94f23fea1e076a7c1cc52..815387388218c6d4b7f5b5152a29d9620c7f9e61 100644 (file)
@@ -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;