Skip to content

gh-161549: Fix file descriptors leak when re-importing _pyrepl.readline - #161557

Open
Eclips4 wants to merge 3 commits into
python:mainfrom
Eclips4:zipimport-refleak
Open

Eclips4 wants to merge 3 commits into
python:mainfrom
Eclips4:zipimport-refleak

Conversation

@Eclips4

@Eclips4 Eclips4 commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Comment thread Lib/_pyrepl/readline.py Resolved
Comment thread Lib/_pyrepl/readline.py
Comment on lines +352 to +353
f_in: int = 0
f_out: int = 1

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, it seems to me that the previous os.dup call was a leftover and doesn’t make sense anymore.

@divya-git03

This comment was marked as low quality.

@Eclips4 Eclips4 added needs backport to 3.14 bugs and security fixes needs backport to 3.15 bugs and security fixes labels Nov 7, 2026

before = fd_count()
wrapper = _ReadlineWrapper()
wrapper.get_reader()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This leaves a SIGCONT handler bound to a console after its PTY closes. Can we count descriptors across repeated imports in a PTY subprocess?

@bedevere-app

bedevere-app Bot commented Nov 26, 2026

Copy link
Copy Markdown

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting changes needs backport to 3.14 bugs and security fixes needs backport to 3.15 bugs and security fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants