https://github.com/python/cpython/commit/94250a7c0f6cbf51ff6b13873d1e611e417061af
commit: 94250a7c0f6cbf51ff6b13873d1e611e417061af
branch: main
author: Victor Stinner <[email protected]>
committer: vstinner <[email protected]>
date: 2026-11-19T00:52:05+01:00
summary:

gh-157695: Make HAVE_RL_CHANGE_ENVIRONMENT macro private (#162213)

Rename HAVE_RL_CHANGE_ENVIRONMENT macro to
_Py_HAVE_RL_CHANGE_ENVIRONMENT (make it private).

files:
M Lib/test/test_readline.py
M Modules/readline.c
M Tools/build/check_capi_macros_ignored.txt
M configure
M configure.ac
M pyconfig.h.in

diff --git a/Lib/test/test_readline.py b/Lib/test/test_readline.py
index f999ea6cc1affd..074faf94d2d792 100644
--- a/Lib/test/test_readline.py
+++ b/Lib/test/test_readline.py
@@ -471,7 +471,7 @@ def test_write_read_limited_history(self):
         # So, we've only tested that the read did not fail.
         # See TestHistoryManipulation for the full test.
 
-    
@unittest.skipUnless(sysconfig.get_config_var("HAVE_RL_CHANGE_ENVIRONMENT"),
+    
@unittest.skipUnless(sysconfig.get_config_var("_Py_HAVE_RL_CHANGE_ENVIRONMENT"),
                          "readline can modify the environment")
     def test_environment_is_not_modified(self):
         # os.environ contains environment at the time "os" module was loaded, 
so
diff --git a/Modules/readline.c b/Modules/readline.c
index 643b1fcb040290..fab0d9aeaa80ae 100644
--- a/Modules/readline.c
+++ b/Modules/readline.c
@@ -1543,7 +1543,7 @@ setup_readline(readlinestate *mod_state)
     /* The name must be defined before initialization */
     rl_readline_name = "python";
 
-#ifdef HAVE_RL_CHANGE_ENVIRONMENT
+#ifdef _Py_HAVE_RL_CHANGE_ENVIRONMENT
     /* Prevent readline from setting the LINES and COLUMNS environment
      * variables: ncurses prefers them over an ioctl() query, so a stale value
      * left after a resize breaks SIGWINCH / KEY_RESIZE handling (gh-46927). */
diff --git a/Tools/build/check_capi_macros_ignored.txt 
b/Tools/build/check_capi_macros_ignored.txt
index 73d4f7be0766b9..dfde88c0c800d6 100644
--- a/Tools/build/check_capi_macros_ignored.txt
+++ b/Tools/build/check_capi_macros_ignored.txt
@@ -435,7 +435,6 @@ HAVE_RECVFROM
 HAVE_RENAMEAT
 HAVE_RL_APPEND_HISTORY
 HAVE_RL_CATCH_SIGNAL
-HAVE_RL_CHANGE_ENVIRONMENT
 HAVE_RL_COMPDISP_FUNC_T
 HAVE_RL_COMPLETION_APPEND_CHARACTER
 HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK
diff --git a/configure b/configure
index a2e9c1711adb79..655558774c4b5f 100755
--- a/configure
+++ b/configure
@@ -30104,7 +30104,7 @@ printf "%s\n" "$ac_cv_readline_rl_change_environment" 
>&6; }
 then :
 
 
-printf "%s\n" "#define HAVE_RL_CHANGE_ENVIRONMENT 1" >>confdefs.h
+printf "%s\n" "#define _Py_HAVE_RL_CHANGE_ENVIRONMENT 1" >>confdefs.h
 
 
 fi
diff --git a/configure.ac b/configure.ac
index 2be6d852c6e977..f6f4055079eaa1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7261,7 +7261,7 @@ AS_VAR_IF([with_readline], [no], [
       )
     ])
     AS_VAR_IF([ac_cv_readline_rl_change_environment], [yes], [
-      AC_DEFINE([HAVE_RL_CHANGE_ENVIRONMENT], [1], [Define if you have 
readline 6.3])
+      AC_DEFINE([_Py_HAVE_RL_CHANGE_ENVIRONMENT], [1], [Define if you have 
readline 6.3])
     ])
 
     # check for readline 4.2
diff --git a/pyconfig.h.in b/pyconfig.h.in
index 18534d7e80e389..90d8a07df66083 100644
--- a/pyconfig.h.in
+++ b/pyconfig.h.in
@@ -1143,9 +1143,6 @@
 /* Define if you can turn off readline's signal handling. */
 #undef HAVE_RL_CATCH_SIGNAL
 
-/* Define if you have readline 6.3 */
-#undef HAVE_RL_CHANGE_ENVIRONMENT
-
 /* Define to 1 if the system has the type 'rl_compdisp_func_t'. */
 #undef HAVE_RL_COMPDISP_FUNC_T
 
@@ -2164,6 +2161,9 @@
 /* Define if you have the 'pthread_attr_get_np' function. */
 #undef _Py_HAVE_PTHREAD_ATTR_GET_NP
 
+/* Define if you have readline 6.3 */
+#undef _Py_HAVE_RL_CHANGE_ENVIRONMENT
+
 /* Define if you have the 'sinpi' function. */
 #undef _Py_HAVE_SINPI
 

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to