Terry J. Reedy <tjre...@udel.edu> added the comment:

After splitting the two reads onto two lines, the indefinite hang happens in 
the second one, stdin.readall.  

    def test_ctrl_z(self):
        with open('CONIN$', 'rb', buffering=0) as stdin:
            source = '\xC4\x1A\r\n'.encode('utf-16-le')
            expected = '\xC4'.encode('utf-8')
            print('here')
            write_input(stdin, source)
            a = stdin.read(1)
##            b = stdin.readall()
            self.assertEqual(expected[0:1], a)
##            self.assertEqual(expected[1:], b)

The resulting failure of the first assertion results in:
FAIL: test_ctrl_z (__main__.WindowsConsoleIOTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "F:\dev\3x\lib\test\test_winconsoleio.py", line 197, in test_ctrl_z
    self.assertEqual(expected[0:1], a)
AssertionError: b'\xc3' != b'\r'

This minimal change would stop the hang crash, which is the first priority.  
However, changing the repeat from 10 to 1, to look like

        prec->Event.KeyEvent.wRepeatCount = 1;


fixes all failures, including the hang.  I will submit for CI testing.
But two questions.

Is this line needed with a repeat of 1, or should it be removed?

Also, this file has a section added by arg clinic.  Does it need to be 
regenerated for this change?  If so, how?

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41729>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to