Skip to content

gh-135621: Simplify TermInfo #136916

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 21, 2025
Merged

gh-135621: Simplify TermInfo #136916

merged 3 commits into from
Jul 21, 2025

Conversation

encukou
Copy link
Member

@encukou encukou commented Jul 21, 2025

_pyrepl.terminfo's terminfo parsing follows ncurses and does a bunch of unnecessary (and untested) work. It can be simplified:

  • Don't parse names, booleans, and numbers. (I hope I left enough code & comments to make it easy to add these if needed.)
  • Don't store the strings as a list; populate the dict directly.
  • Use struct.iter_unpack and string_table.find instead of for loops

@ambv ambv merged commit 28153fe into python:main Jul 21, 2025
52 checks passed
@ambv ambv added the needs backport to 3.14 bugs and security fixes label Jul 21, 2025
@miss-islington-app
Copy link

Thanks @encukou for the PR, and @ambv for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 21, 2025
(cherry picked from commit 28153fe)

Co-authored-by: Petr Viktorin <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Jul 21, 2025

GH-136925 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Jul 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants