Skip to content

Pyrepl (on Windows) crashes when running a script under hyperfine #133430

@pfmoore

Description

@pfmoore

Bug report

Bug description:

Create a simple program, something like test.py:

print("hello")

Run this under hyperfine, as hyperfine python test.py. This fails with an error (non-zero exit code 1)

Running with --show-output gives the traceback

Python 3.13.2 (tags/v3.13.2:4f8bb39, Feb  4 2025, 15:23:48) [MSC v.1942 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\Gustav\AppData\Local\Programs\Python\Python313\Lib\_pyrepl\__main__.py", line 6, in <module>
    __pyrepl_interactive_console()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "C:\Users\Gustav\AppData\Local\Programs\Python\Python313\Lib\_pyrepl\main.py", line 59, in interactive_console
    run_multiline_interactive_console(console)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "C:\Users\Gustav\AppData\Local\Programs\Python\Python313\Lib\_pyrepl\simple_interact.py", line 143, in run_multiline_interactive_console
    statement = multiline_input(more_lines, ps1, ps2)
  File "C:\Users\Gustav\AppData\Local\Programs\Python\Python313\Lib\_pyrepl\readline.py", line 389, in multiline_input
    return reader.readline()
           ~~~~~~~~~~~~~~~^^
  File "C:\Users\Gustav\AppData\Local\Programs\Python\Python313\Lib\_pyrepl\reader.py", line 802, in readline
    self.handle1()
    ~~~~~~~~~~~~^^
  File "C:\Users\Gustav\AppData\Local\Programs\Python\Python313\Lib\_pyrepl\reader.py", line 758, in handle1
    event = self.console.get_event(block=False)
  File "C:\Users\Gustav\AppData\Local\Programs\Python\Python313\Lib\_pyrepl\windows_console.py", line 397, in get_event
    rec = self._read_input(block)
  File "C:\Users\Gustav\AppData\Local\Programs\Python\Python313\Lib\_pyrepl\windows_console.py", line 378, in _read_input
    raise WinError(GetLastError())
OSError: [WinError 0] The operation completed successfully.

As far as I can tell, pyrepl seems to be detecting standard input as a console, when it's not (the hyperfine help text says that the default is to take input from "/dev/null" - presumably the null device on Windows.

CPython versions tested on:

3.13

Operating systems tested on:

Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-windowstopic-replRelated to the interactive shelltype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions