Skip to content

perf: defer getpass import in console.py to Console.input()#6

Closed
KRRT7 wants to merge 1 commit intomasterfrom
perf/defer-getpass-console
Closed

perf: defer getpass import in console.py to Console.input()#6
KRRT7 wants to merge 1 commit intomasterfrom
perf/defer-getpass-console

Conversation

@KRRT7
Copy link
Copy Markdown
Owner

@KRRT7 KRRT7 commented Apr 9, 2026

Summary

Move from getpass import getpass from module level to inside Console.input(), only when password=True. The getpass module imports contextlib and termios which are unnecessary for normal Console usage.

Test updated to patch getpass.getpass instead of the module-level name.

Testing

952 passed on CPython 3.9–3.14 and PyPy 3.10.

Move `from getpass import getpass` from module level to inside the
`input()` method, only when password=True. The getpass module imports
contextlib and termios which are unnecessary for normal Console usage.
@KRRT7
Copy link
Copy Markdown
Owner Author

KRRT7 commented Apr 9, 2026

Superseded by the consolidated stacked PRs #12 + #13.

@KRRT7 KRRT7 closed this Apr 9, 2026
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.

1 participant