Skip to content
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

Refactor output printer so that it can render big outputs without memory issues. #562

Merged
merged 3 commits into from
Dec 12, 2023

Conversation

jonathanslenders
Copy link
Member

@jonathanslenders jonathanslenders commented Dec 12, 2023

Previously, an expression like b'\x90' * 40_000_000 would kill ptpython because it rendered the whole output at once. This implementation streams the rendering logic while it's paginating.

This PR also contains typing fixes as well as asyncio-related improvements (in separate commits).

@jonathanslenders jonathanslenders force-pushed the refactor-output-printer branch 5 times, most recently from a1b7b89 to e156c6d Compare December 12, 2023 16:16
…ory issues.

Previously, an expression like `b'\x90' * 40_000_000` would kill ptpython
because it rendered the whole output at once. This implementation streams the
rendering logic while it's paginating.
- Added `--asyncio` flag to the `ptpython` entry point to activate the
  asyncio-REPL. This will ensure that an event loop is created at the start in
  which we can run top-level await statements.
- Use `get_running_loop()` instead of `get_event_loop()`.
- Better handling of `SystemExit` and control-c in the async REPL.
@jonathanslenders jonathanslenders merged commit f019301 into master Dec 12, 2023
10 checks passed
@jonathanslenders jonathanslenders deleted the refactor-output-printer branch December 12, 2023 22:27
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