GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — GH-130328: further speedup of pasting in new REPL on Windows by reading in chunks by chris-eibl · Pull Request #132889 · python/cpython Conversation
|
| """Return the characters that have been typed but not yet | ||
| processed.""" | ||
| return Event("key", "", b"") | ||
| e = Event("key", "", b"") |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I've just copy-pasted this from
cpython/Lib/_pyrepl/unix_console.py
Lines 536 to 555 in e1c09ff
| def getpending(self): | |
| """ | |
| Get pending events from the console event queue. | |
| Returns: | |
| - Event: Pending event from the event queue. | |
| """ | |
| e = Event("key", "", b"") | |
| while not self.event_queue.empty(): | |
| e2 = self.event_queue.get() | |
| e.data += e2.data | |
| e.raw += e.raw | |
| amount = 10000 | |
| raw = self.__read(amount) | |
| data = str(raw, self.encoding, "replace") | |
| e.data += data | |
| e.raw += raw | |
| return e |
and dropped the reading of the next chunk, since IMHO this does not fit the doc string.
mypy fires here
Lib/_pyrepl/windows_console.py:545: error: Item "None" of "Event | None" has no
attribute "data" [union-attr]
e.data += e2.data
^~~~~~~
Found 1 error in 1 file (checked 25 source files)
and is indeed correct. Have to dig in why we do not see this in case of unix_console.py ...
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| return False | ||
| return True | ||
|
|
||
| def wait(self, timeout: float | None = None) -> bool: |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Full in sync with unix_console.py now :)
cpython/Lib/_pyrepl/unix_console.py
Lines 419 to 427 in e1c09ff
| def wait(self, timeout: float | None = None) -> bool: | |
| """ | |
| Wait for events on the console. | |
| """ | |
| return ( | |
| not self.event_queue.empty() | |
| or self.more_in_buffer() | |
| or bool(self.pollob.poll(timeout)) | |
| ) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
in class Reader
to use self.paste_mode instead of self.in_bracketed_paste in class Reader
This reverts commit bba26c9.
to revert "use self.paste_mode instead of self.in_bracketed_paste"
# Conflicts: # Lib/_pyrepl/windows_console.py
it isn't used in the whole code, and some code paths in WindowsConsole set it to str instead of bytes
…into read_chunked
|
Closed because superseded by #133247 (comment). |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.