GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GH-130328: Speedup pasting in legacy console on Windows by chris-eibl · Pull Request #133728 · python/cpython

Conversation

@chris-eibl

@chris-eibl chris-eibl commented May 9, 2025 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member
  • Issue: Pasting in new REPL is slow #130328

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
chris-eibl added 3 commits May 9, 2025 08:34
@chris-eibl
initial minimal needed changes
e352f79
@chris-eibl
move blocking / waiting to get_event like in unix_console.py
4dc4238
@chris-eibl
remove console.wait(100) in perform_bracketed_paste
7f02127
@chris-eibl
chris-eibl requested review from ambv, lysnikolaou and pablogsal as code owners May 9, 2025 06:57
@bedevere-app bedevere-app Bot mentioned this pull request May 9, 2025
Pasting in new REPL is slow #130328
Closed
@bedevere-app bedevere-app Bot added the awaiting review label May 9, 2025
chris-eibl
chris-eibl commented May 9, 2025
View reviewed changes
Comment thread Lib/_pyrepl/windows_console.py
recs, rec_count = self._read_input_bulk(1024)
for i in range(rec_count):
rec = recs[i]
# In case of a legacy console, we do not only receive a keydown

@chris-eibl chris-eibl May 9, 2025

Copy link
Copy Markdown
Member Author

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?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
chris-eibl
chris-eibl commented May 9, 2025
View reviewed changes
Comment thread Lib/_pyrepl/windows_console.py
and there is no event pending, otherwise waits for the
completion of an event."""

if not block and not self.wait(timeout=0):

@chris-eibl chris-eibl May 9, 2025

Copy link
Copy Markdown
Member Author

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

ambv reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
chris-eibl
chris-eibl commented May 9, 2025
View reviewed changes
Comment thread Lib/_pyrepl/commands.py
data = ""
start = time.time()
while done not in data:
self.reader.console.wait(100)

@chris-eibl chris-eibl May 9, 2025

Copy link
Copy Markdown
Member Author

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@chris-eibl
blurb it
7c06902
ambv
ambv approved these changes May 25, 2025
View reviewed changes

@ambv ambv left a comment

Copy link
Copy Markdown
Contributor

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chris-eibl reacted with heart emoji
All reactions
  • ❤️ 1 reaction
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels May 25, 2025
@ambv ambv added the needs backport to 3.14 bugs and security fixes label May 25, 2025
@ambv
ambv merged commit 91b4886 into python:main May 25, 2025
@miss-islington-app

miss-islington-app Bot commented May 25, 2025

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label May 25, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 25, 2025
@chris-eibl @miss-islington
pythonGH-130328: Speedup pasting in legacy console on Windows (python…
15a414d
…gh-133728)

(cherry picked from commit 91b4886)

Co-authored-by: Chris Eibl <[email protected]>
@bedevere-app

bedevere-app Bot commented May 25, 2025

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label May 25, 2025
ambv pushed a commit that referenced this pull request May 25, 2025
@miss-islington @chris-eibl
[3.14] GH-130328: Speedup pasting in legacy console on Windows (gh-13…
93aee56
…3728) (#134653)

(cherry picked from commit 91b4886)

Co-authored-by: Chris Eibl <[email protected]>
@bedevere-bot

bedevere-bot commented May 25, 2025

Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot AMD64 Windows10 3.x (tier-1) has failed when building commit 91b4886.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/146/builds/11526) and take a look at the build logs.
  4. Check if the failure is related to this commit (91b4886) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/146/builds/11526

Failed tests:

  • test_pyrepl

Failed subtests:

  • test_up_vt - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_up_vt
  • test_left - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_left
  • test_KEY_EVENT_up_ignored - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_KEY_EVENT_up_ignored
  • test_enter_vt - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_enter_vt
  • test_m_LEFT_ALT_PRESSED_and_LEFT_CTRL_PRESSED - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_m_LEFT_ALT_PRESSED_and_LEFT_CTRL_PRESSED
  • test_WINDOW_BUFFER_SIZE_EVENT - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_WINDOW_BUFFER_SIZE_EVENT
  • test_backspace_vt - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_backspace_vt
  • test_left_RIGHT_CTRL_PRESSED - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_left_RIGHT_CTRL_PRESSED
  • test_AltGr_m - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_AltGr_m
  • test_EmptyBuffer - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_EmptyBuffer
  • test_unhandled_events - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_unhandled_events
  • test_left_RIGHT_ALT_PRESSED - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_left_RIGHT_ALT_PRESSED
  • test_AltGr_7 - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_AltGr_7
  • test_m_LEFT_ALT_PRESSED - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_m_LEFT_ALT_PRESSED
  • test_backspace - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_backspace
  • test_enter - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_enter
  • test_M - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_M
  • test_m - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_m
  • test_umlaut_a_german - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_umlaut_a_german
  • test_left_LEFT_ALT_PRESSED - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_left_LEFT_ALT_PRESSED
  • test_left_LEFT_CTRL_PRESSED - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_left_LEFT_CTRL_PRESSED
  • test_m_RIGHT_ALT_PRESSED - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_m_RIGHT_ALT_PRESSED

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):
  File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 415, in test_WINDOW_BUFFER_SIZE_EVENT
    self.assertEqual(self.get_event([ir]), Event("resize", ""))
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != Event(evt='resize', data='', raw=b'')


Traceback (most recent call last):
  File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 466, in test_left_RIGHT_CTRL_PRESSED
    self.assertEqual(
    ~~~~~~~~~~~~~~~~^
        self.get_event([ir]), Event("key", "ctrl left"))
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != Event(evt='key', data='ctrl left', raw=b'')


Traceback (most recent call last):
  File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 534, in test_AltGr_7
    self.assertEqual(self.get_event([ir]), Event("key", "{"))
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != Event(evt='key', data='{', raw=b'')


Traceback (most recent call last):
  File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 454, in test_M
    self.assertEqual(self.get_event([ir]), Event("key", "M"))
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != Event(evt='key', data='M', raw=b'')


Traceback (most recent call last):
  File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 562, in test_enter_vt
    self.assertEqual(self.get_event([ir], vt_support=True),
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                     Event("key", "\n"))
                     ^^^^^^^^^^^^^^^^^^^
AssertionError: None != Event(evt='key', data='\n', raw=b'')


Traceback (most recent call last):
  File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 449, in test_m
    self.assertEqual(self.get_event([ir]), Event("key", "m"))
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != Event(evt='key', data='m', raw=b'')


Traceback (most recent call last):
  File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 510, in test_m_LEFT_ALT_PRESSED
    self.assertEqual(self.get_event([ir]), Event(evt="key", data="\033"))
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != Event(evt='key', data='\x1b', raw=b'')


Traceback (most recent call last):
  File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 548, in test_umlaut_a_german
    self.assertEqual(self.get_event([ir]), Event("key", "�"))
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != Event(evt='key', data='�', raw=b'')


Traceback (most recent call last):
  File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 517, in test_m_RIGHT_ALT_PRESSED
    self.assertEqual(self.get_event([ir]), Event(evt="key", data="\033"))
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != Event(evt='key', data='\x1b', raw=b'')


Traceback (most recent call last):
  File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 543, in test_AltGr_m
    self.assertEqual(self.get_event([ir]), Event("key", "�"))
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != Event(evt='key', data='�', raw=b'')


Traceback (most recent call last):
  File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 443, in test_backspace
    self.assertEqual(
    ~~~~~~~~~~~~~~~~^
        self.get_event([ir]), Event("key", "backspace"))
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != Event(evt='key', data='backspace', raw=b'')


Traceback (most recent call last):
  File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 473, in test_left_LEFT_CTRL_PRESSED
    self.assertEqual(
    ~~~~~~~~~~~~~~~~^
        self.get_event([ir]), Event("key", "ctrl left"))
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != Event(evt='key', data='ctrl left', raw=b'')


Traceback (most recent call last):
  File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 480, in test_left_RIGHT_ALT_PRESSED
    self.assertEqual(self.get_event([ir]), Event(evt="key", data="\033"))
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != Event(evt='key', data='\x1b', raw=b'')


Traceback (most recent call last):
  File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 460, in test_left
    self.assertEqual(self.get_event([ir]), Event("key", "left"))
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != Event(evt='key', data='left', raw=b'')


Traceback (most recent call last):
  File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 434, in test_unhandled_events
    self.assertEqual(self.mock.call_count, 1)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 0 != 1


Traceback (most recent call last):
  File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 438, in test_enter
    self.assertEqual(self.get_event([ir]), Event("key", "\n"))
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != Event(evt='key', data='\n', raw=b'')


Traceback (most recent call last):
  File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 407, in test_EmptyBuffer
    self.assertEqual(self.mock.call_count, 1)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 0 != 1


Traceback (most recent call last):
  File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 490, in test_left_LEFT_ALT_PRESSED
    self.assertEqual(self.get_event([ir]), Event(evt="key", data="\033"))
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != Event(evt='key', data='\x1b', raw=b'')


Traceback (most recent call last):
  File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 574, in test_up_vt
    self.assertEqual(self.get_event(irs, vt_support=True),
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                     Event(evt='key', data='up', raw=bytearray(b'\x1b[A')))
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != Event(evt='key', data='up', raw=bytearray(b'\x1b[A'))


Traceback (most recent call last):
  File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 505, in test_m_LEFT_ALT_PRESSED_and_LEFT_CTRL_PRESSED
    self.assertEqual(self.mock.call_count, 1)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 0 != 1


Traceback (most recent call last):
  File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 568, in test_backspace_vt
    self.assertEqual(self.get_event([ir], vt_support=True),
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                     Event("key", "backspace", b"\x7f"))
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != Event(evt='key', data='backspace', raw=b'\x7f')


Traceback (most recent call last):
  File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 424, in test_KEY_EVENT_up_ignored
    self.assertEqual(self.mock.call_count, 1)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 0 != 1
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ambv

ambv commented May 25, 2025

Copy link
Copy Markdown
Contributor

@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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot

bedevere-bot commented May 25, 2025

Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot AMD64 Windows10 3.14 (tier-1) has failed when building commit 93aee56.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1711/builds/99) and take a look at the build logs.
  4. Check if the failure is related to this commit (93aee56) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1711/builds/99

Failed tests:

  • test_pyrepl

Failed subtests:

  • test_up_vt - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_up_vt
  • test_left - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_left
  • test_KEY_EVENT_up_ignored - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_KEY_EVENT_up_ignored
  • test_enter_vt - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_enter_vt
  • test_m_LEFT_ALT_PRESSED_and_LEFT_CTRL_PRESSED - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_m_LEFT_ALT_PRESSED_and_LEFT_CTRL_PRESSED
  • test_WINDOW_BUFFER_SIZE_EVENT - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_WINDOW_BUFFER_SIZE_EVENT
  • test_backspace_vt - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_backspace_vt
  • test_left_RIGHT_CTRL_PRESSED - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_left_RIGHT_CTRL_PRESSED
  • test_AltGr_m - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_AltGr_m
  • test_EmptyBuffer - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_EmptyBuffer
  • test_unhandled_events - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_unhandled_events
  • test_left_RIGHT_ALT_PRESSED - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_left_RIGHT_ALT_PRESSED
  • test_AltGr_7 - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_AltGr_7
  • test_m_LEFT_ALT_PRESSED - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_m_LEFT_ALT_PRESSED
  • test_backspace - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_backspace
  • test_enter - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_enter
  • test_M - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_M
  • test_m - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_m
  • test_umlaut_a_german - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_umlaut_a_german
  • test_left_LEFT_ALT_PRESSED - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_left_LEFT_ALT_PRESSED
  • test_left_LEFT_CTRL_PRESSED - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_left_LEFT_CTRL_PRESSED
  • test_m_RIGHT_ALT_PRESSED - test.test_pyrepl.test_windows_console.WindowsConsoleGetEventTests.test_m_RIGHT_ALT_PRESSED

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):
  File "D:\buildarea\3.14.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 466, in test_left_RIGHT_CTRL_PRESSED
    self.assertEqual(
    ~~~~~~~~~~~~~~~~^
        self.get_event([ir]), Event("key", "ctrl left"))
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != Event(evt='key', data='ctrl left', raw=b'')


Traceback (most recent call last):
  File "D:\buildarea\3.14.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 449, in test_m
    self.assertEqual(self.get_event([ir]), Event("key", "m"))
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != Event(evt='key', data='m', raw=b'')


Traceback (most recent call last):
  File "D:\buildarea\3.14.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 480, in test_left_RIGHT_ALT_PRESSED
    self.assertEqual(self.get_event([ir]), Event(evt="key", data="\033"))
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != Event(evt='key', data='\x1b', raw=b'')


Traceback (most recent call last):
  File "D:\buildarea\3.14.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 473, in test_left_LEFT_CTRL_PRESSED
    self.assertEqual(
    ~~~~~~~~~~~~~~~~^
        self.get_event([ir]), Event("key", "ctrl left"))
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != Event(evt='key', data='ctrl left', raw=b'')


Traceback (most recent call last):
  File "D:\buildarea\3.14.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 407, in test_EmptyBuffer
    self.assertEqual(self.mock.call_count, 1)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 0 != 1


Traceback (most recent call last):
  File "D:\buildarea\3.14.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 454, in test_M
    self.assertEqual(self.get_event([ir]), Event("key", "M"))
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != Event(evt='key', data='M', raw=b'')


Traceback (most recent call last):
  File "D:\buildarea\3.14.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 438, in test_enter
    self.assertEqual(self.get_event([ir]), Event("key", "\n"))
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != Event(evt='key', data='\n', raw=b'')


Traceback (most recent call last):
  File "D:\buildarea\3.14.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 460, in test_left
    self.assertEqual(self.get_event([ir]), Event("key", "left"))
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != Event(evt='key', data='left', raw=b'')


Traceback (most recent call last):
  File "D:\buildarea\3.14.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 424, in test_KEY_EVENT_up_ignored
    self.assertEqual(self.mock.call_count, 1)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 0 != 1


Traceback (most recent call last):
  File "D:\buildarea\3.14.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 568, in test_backspace_vt
    self.assertEqual(self.get_event([ir], vt_support=True),
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                     Event("key", "backspace", b"\x7f"))
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != Event(evt='key', data='backspace', raw=b'\x7f')


Traceback (most recent call last):
  File "D:\buildarea\3.14.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 534, in test_AltGr_7
    self.assertEqual(self.get_event([ir]), Event("key", "{"))
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != Event(evt='key', data='{', raw=b'')


Traceback (most recent call last):
  File "D:\buildarea\3.14.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 510, in test_m_LEFT_ALT_PRESSED
    self.assertEqual(self.get_event([ir]), Event(evt="key", data="\033"))
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != Event(evt='key', data='\x1b', raw=b'')


Traceback (most recent call last):
  File "D:\buildarea\3.14.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 548, in test_umlaut_a_german
    self.assertEqual(self.get_event([ir]), Event("key", "�"))
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != Event(evt='key', data='�', raw=b'')


Traceback (most recent call last):
  File "D:\buildarea\3.14.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 415, in test_WINDOW_BUFFER_SIZE_EVENT
    self.assertEqual(self.get_event([ir]), Event("resize", ""))
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != Event(evt='resize', data='', raw=b'')


Traceback (most recent call last):
  File "D:\buildarea\3.14.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 543, in test_AltGr_m
    self.assertEqual(self.get_event([ir]), Event("key", "�"))
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != Event(evt='key', data='�', raw=b'')


Traceback (most recent call last):
  File "D:\buildarea\3.14.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 574, in test_up_vt
    self.assertEqual(self.get_event(irs, vt_support=True),
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                     Event(evt='key', data='up', raw=bytearray(b'\x1b[A')))
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != Event(evt='key', data='up', raw=bytearray(b'\x1b[A'))


Traceback (most recent call last):
  File "D:\buildarea\3.14.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 434, in test_unhandled_events
    self.assertEqual(self.mock.call_count, 1)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 0 != 1


Traceback (most recent call last):
  File "D:\buildarea\3.14.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 517, in test_m_RIGHT_ALT_PRESSED
    self.assertEqual(self.get_event([ir]), Event(evt="key", data="\033"))
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != Event(evt='key', data='\x1b', raw=b'')


Traceback (most recent call last):
  File "D:\buildarea\3.14.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 490, in test_left_LEFT_ALT_PRESSED
    self.assertEqual(self.get_event([ir]), Event(evt="key", data="\033"))
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != Event(evt='key', data='\x1b', raw=b'')


Traceback (most recent call last):
  File "D:\buildarea\3.14.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 505, in test_m_LEFT_ALT_PRESSED_and_LEFT_CTRL_PRESSED
    self.assertEqual(self.mock.call_count, 1)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 0 != 1


Traceback (most recent call last):
  File "D:\buildarea\3.14.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 443, in test_backspace
    self.assertEqual(
    ~~~~~~~~~~~~~~~~^
        self.get_event([ir]), Event("key", "backspace"))
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != Event(evt='key', data='backspace', raw=b'')


Traceback (most recent call last):
  File "D:\buildarea\3.14.bolen-windows10\build\Lib\test\test_pyrepl\test_windows_console.py", line 562, in test_enter_vt
    self.assertEqual(self.get_event([ir], vt_support=True),
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                     Event("key", "\n"))
                     ^^^^^^^^^^^^^^^^^^^
AssertionError: None != Event(evt='key', data='\n', raw=b'')
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chris-eibl

chris-eibl commented May 25, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

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:

--- a/Lib/test/test_pyrepl/test_windows_console.py
+++ b/Lib/test/test_pyrepl/test_windows_console.py
@@ -386,6 +386,7 @@ def get_event(self, input_records, **kwargs) -> Console:
         self.console._read_input = self.mock
         self.console._WindowsConsole__vt_support = kwargs.get("vt_support",
                                                               False)
+        self.console.wait = MagicMock(return_value=True)

in these tests I've introduced in #132439. They shouldn't depend on wait, which was moved in this PR into get_event. Particulary WaitForSingleObject(InHandle) is no good here, and I just wonder now, why they pass when the tests are run in a Windows terminal.

I must have run the tests back then in a Windows terminal, and most probably all the GH bots are Windows 11 based, too?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chris-eibl

chris-eibl commented May 25, 2025

Copy link
Copy Markdown
Member Author

Do you want me to create a PR or is the above diff sufficient?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chris-eibl chris-eibl mentioned this pull request May 25, 2025
GH-130328: Fix WindowsConsoleGetEventTests after gh-133728 #134660
Merged
ambv pushed a commit that referenced this pull request May 25, 2025
@chris-eibl
GH-130328: Fix WindowsConsoleGetEventTests after gh-133728 (gh-134660)
1000283
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 25, 2025
@chris-eibl @miss-islington
pythonGH-130328: Fix WindowsConsoleGetEventTests after pythongh-133728 (
0422edf
pythongh-134660)

(cherry picked from commit 1000283)

Co-authored-by: Chris Eibl <[email protected]>
ambv pushed a commit that referenced this pull request May 25, 2025
@miss-islington @chris-eibl
[3.14] GH-130328: Fix WindowsConsoleGetEventTests after gh-133728 (gh…
6917fbf
…-134660) (gh-134666)

(cherry picked from commit 1000283)

Co-authored-by: Chris Eibl <[email protected]>
@chris-eibl
chris-eibl deleted the speedup_paste_legacy branch May 26, 2025 05:55
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
@chris-eibl @Pranjal095
pythonGH-130328: Speedup pasting in legacy console on Windows (python…
a295503
…gh-133728)
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
@chris-eibl @Pranjal095
pythonGH-130328: Fix WindowsConsoleGetEventTests after pythongh-133728 (
c248bcb
pythongh-134660)
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request Aug 4, 2025
@chris-eibl @taegyunkim
pythonGH-130328: Speedup pasting in legacy console on Windows (python…
7d95b30
…gh-133728)
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request Aug 4, 2025
@chris-eibl @taegyunkim
pythonGH-130328: Fix WindowsConsoleGetEventTests after pythongh-133728 (
3a120b1
pythongh-134660)
gostak-dd pushed a commit to gostak-dd/cpython that referenced this pull request Jun 2, 2026
@chris-eibl @gostak-dd
pythonGH-130328: Speedup pasting in legacy console on Windows (python…
42b1d99
…gh-133728)
gostak-dd pushed a commit to gostak-dd/cpython that referenced this pull request Jun 2, 2026
@chris-eibl @gostak-dd
pythonGH-130328: Fix WindowsConsoleGetEventTests after pythongh-133728 (
0d7b88f
pythongh-134660)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@ambv ambv ambv approved these changes
@pablogsal pablogsal Awaiting requested review from pablogsal pablogsal is a code owner
@lysnikolaou lysnikolaou Awaiting requested review from lysnikolaou lysnikolaou is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@chris-eibl @bedevere-bot @ambv
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.