gh-46927: Prevent readline from overriding environment#133585
gh-46927: Prevent readline from overriding environment#133585mbriand wants to merge 3 commits intopython:mainfrom
Conversation
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
4465cf1 to
c2e4e29
Compare
| /* The name must be defined before initialization */ | ||
| rl_readline_name = "python"; | ||
|
|
||
| #if !defined(__APPLE__) |
There was a problem hiding this comment.
I'm a bit surprised I had to rely on the __APPLE__ define here. As I understand apple OS is using libedit, so I would have thought relying on WITH_EDITLINE would be enough. But the macOS pipeline proved me wrong...
ZeroIntensity
left a comment
There was a problem hiding this comment.
Please add a test case. The file you're looking for is test_readline.
Misc/NEWS.d/next/Core_and_Builtins/2025-05-07-18-31-31.gh-issue-46927.sF02gj.rst
Outdated
Show resolved
Hide resolved
|
Hi! Any news about this PR? Is there anything I can do to help the this modification being accepted? |
Readline library will set the LINES and COLUMNS environment variables during initialization. One might expect these variables to be updated later on SIGWINCH, but this is not the case with cpython. As a consequence, when the readline module is imported, any process launched from cpython with the default environment will have LINES and COLUMNS variables set, potentially to a wrong value. Use the rl_change_environment global variable to disable this initial setup of the environment variables.
a91fe5d to
4d18a9c
Compare
|
I rebased on current main branch. I confirm the issue is still present today. Again, if there is anything I can to to help getting this merged, please tell me. |
Readline library will set the LINES and COLUMNS environment variables during initialization. One might expect these variables to be updated later on SIGWINCH, but this is not the case with cpython.
As a consequence, when the readline module is imported, any process launched from cpython with the default environment will have LINES and COLUMNS variables set, potentially to a wrong value.
Use the rl_change_environment global variable to disable this initial setup of the environment variables.