Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
GH-130328: Speedup pasting in legacy console on Windows#133728
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
| recs, rec_count=self._read_input_bulk(1024) | ||
| foriinrange(rec_count): | ||
| rec=recs[i] | ||
| # In case of a legacy console, we do not only receive a keydown |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, there is a lot of duplicated logic from get_event now. Maybe refactor that, so the logic can be reused here?
| and there is no event pending, otherwise waits for the | ||
| completion of an event.""" | ||
| ifnotblockandnotself.wait(timeout=0): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have moved blocking and waiting logic into get_event like in unix_console.py. IMHO that shouldn't be part of reading and we're in perfect sync with Unix now.
| data="" | ||
| start=time.time() | ||
| whiledonenotindata: | ||
| self.reader.console.wait(100) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is needed. Works for me without it. For both, Linux and Windows, this will immediately return in case of pending data, and just needlessly waits 100 ms if there is no more data.
ambv left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is perfect. You utilized my getpending() implementation without adding any double-buffering. It is indeed speeding things up dramatically while not breaking the existing bracketed paste behavior.
91b4886 into python:mainUh oh!
There was an error while loading. Please reload this page.
Thanks @chris-eibl for the PR, and @ambv for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
…gh-133728) (cherry picked from commit 91b4886) Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
GH-134653 is a backport of this pull request to the 3.14 branch. |
bedevere-bot commented May 25, 2025
|
ambv commented May 25, 2025
@chris-eibl this buildbot failure ^^^ is real. I can't explain that yet and cannot reproduce it locally on Win 11, but if I don't manage to fix it before tomorrow's 3.14 beta 2, I will have to revert the backport. |
bedevere-bot commented May 25, 2025
|
chris-eibl commented May 25, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
I can reproduce these failures on Windows 10, too, for both main and 3.14 when running in a legacy console. In fact, the fix is simple: in these tests I've introduced in #132439. They shouldn't depend on I must have run the tests back then in a Windows terminal, and most probably all the GH bots are Windows 11 based, too? |
chris-eibl commented May 25, 2025
Do you want me to create a PR or is the above diff sufficient? |
pythongh-134660) (cherry picked from commit 1000283) Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.