Skip to content

Conversation

@chris-eibl
Copy link
Member

@chris-eiblchris-eibl commented May 9, 2025

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
Copy link
MemberAuthor

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):
Copy link
MemberAuthor

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)
Copy link
MemberAuthor

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.

Copy link
Contributor

@ambvambv left a 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.

@ambvambv added the needs backport to 3.14 bugs and security fixes label May 25, 2025
@ambvambv merged commit 91b4886 into python:mainMay 25, 2025
53 checks passed
@miss-islington-app
Copy link

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

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 25, 2025
…gh-133728) (cherry picked from commit 91b4886) Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
@bedevere-app
Copy link

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

@bedevere-appbedevere-appbot 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
…3728) (#134653) (cherry picked from commit 91b4886) Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
@bedevere-bot
Copy link

⚠️⚠️⚠️ 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_EVENTself.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_PRESSEDself.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_7self.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_Mself.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_vtself.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_mself.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_PRESSEDself.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_germanself.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_PRESSEDself.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_mself.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_backspaceself.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_PRESSEDself.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_PRESSEDself.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_leftself.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_eventsself.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_enterself.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_EmptyBufferself.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_PRESSEDself.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_vtself.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_PRESSEDself.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_vtself.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_ignoredself.assertEqual(self.mock.call_count, 1) ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^AssertionError: 0 != 1

@ambv
Copy link
Contributor

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
Copy link

⚠️⚠️⚠️ 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_PRESSEDself.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_mself.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_PRESSEDself.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_PRESSEDself.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_EmptyBufferself.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_Mself.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_enterself.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_leftself.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_ignoredself.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_vtself.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_7self.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_PRESSEDself.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_germanself.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_EVENTself.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_mself.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_vtself.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_eventsself.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_PRESSEDself.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_PRESSEDself.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_PRESSEDself.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_backspaceself.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_vtself.assertEqual(self.get_event([ir], vt_support=True), ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Event("key", "\n")) ^^^^^^^^^^^^^^^^^^^AssertionError: None != Event(evt='key', data='\n', raw=b'')

@chris-eibl
Copy link
MemberAuthor

chris-eibl commented May 25, 2025

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?

@chris-eibl
Copy link
MemberAuthor

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

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 25, 2025
pythongh-134660) (cherry picked from commit 1000283) Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
ambv pushed a commit that referenced this pull request May 25, 2025
…-134660) (gh-134666) (cherry picked from commit 1000283) Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
@chris-eiblchris-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
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request Aug 4, 2025
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request Aug 4, 2025
Sign up for freeto 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.

3 participants

@chris-eibl@bedevere-bot@ambv