Skip to content

Commit d228825

Browse files
authored
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.
1 parent e5252c6 commit d228825

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

Include/cpython/pythonrun.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,5 +117,4 @@ PyAPI_FUNC(PyObject *) PyRun_FileFlags(FILE *fp, const char *p, int s, PyObject
117117

118118
/* Stuff with no proper home (yet) */
119119
PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, const char *);
120-
PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState;
121120
PyAPI_DATA(char) *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, const char *);

Modules/readline.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,6 +1313,9 @@ rlhandler(char *text)
13131313
static char *
13141314
readline_until_enter_or_signal(const char *prompt, int *signal)
13151315
{
1316+
// Defined in Parser/myreadline.c
1317+
extern PyThreadState *_PyOS_ReadlineTState;
1318+
13161319
char * not_done_reading = "";
13171320
fd_set selectset;
13181321

Parser/myreadline.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
#endif /* MS_WINDOWS */
2121

2222

23-
PyThreadState* _PyOS_ReadlineTState = NULL;
23+
// Export the symbol since it's used by the readline shared extension
24+
PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState;
25+
PyThreadState *_PyOS_ReadlineTState = NULL;
2426

2527
static PyThread_type_lock _PyOS_ReadlineLock = NULL;
2628

0 commit comments

Comments
 (0)