Skip to content

Conversation

@gaogaotiantian
Copy link
Member

@gaogaotiantian gaogaotiantian commented Sep 24, 2025

We made the rlcompleter import even lazier. It will now only be imported when being used. We also need to customize the import procedure to avoid having side effects of changing the completer. However, the atexit callback will still be added.

This is not the final solution, but it can fix the refleak while not exposing the original problem again. We should polish it after we fix the import rlcompleter side effect for good.

@gaogaotiantian gaogaotiantian added the needs backport to 3.13 bugs and security fixes label Sep 24, 2025
@gaogaotiantian
Copy link
Member Author

Hey @encukou , as this fixes the broken buildbot, should we try to expedite it?

@gaogaotiantian
Copy link
Member Author

Maybe @iritkatriel can help with the review as you are familiar with the background? The original code has no problem with its own but the existing issue of rlcompleter is exposed by it - and it broke refleak bot. I think we should expedite it to restore the bot.

@gaogaotiantian gaogaotiantian merged commit 8288f36 into python:main Sep 26, 2025
45 checks passed
@miss-islington-app
Copy link

Thanks @gaogaotiantian for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

@gaogaotiantian gaogaotiantian deleted the fix-rlcompleter-leak branch September 26, 2025 14:17
@miss-islington-app
Copy link

Sorry, @gaogaotiantian, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 8288f3693f50058ad9b9fe04e01f5dad902d8bad 3.13

@bedevere-app
Copy link

bedevere-app bot commented Sep 26, 2025

GH-139357 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Sep 26, 2025
gaogaotiantian added a commit that referenced this pull request Sep 26, 2025
encukou pushed a commit to miss-islington/cpython that referenced this pull request Oct 9, 2025
encukou pushed a commit that referenced this pull request Oct 10, 2025
… subprocess (GH-139185) (GH-139305) (GH-139280)

* gh-138860: Lazy import rlcompleter in pdb to avoid deadlock in subprocess (GH-139185)
(cherry picked from commit c8624cd)

* gh-139289: Lazy import rlcompleter to fix the refleak (GH-139305)
(cherry picked from commit 8288f36)

Co-authored-by: Tian Gao <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants