def _readline_workaround():
if sys.platform.startswith("<STR_LIT:win32>"):<EOL><INDENT>try:<EOL><INDENT>import readline  <EOL><DEDENT>except ImportError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>
Ensure readline is imported so that it attaches to the correct stdio
handles on Windows.

Pdb uses readline support where available--when not running from the Python
prompt, the readline module is not imported until running the pdb REPL.  If
running pytest with the --pdb option this means the readline module is not
imported until after I/O capture has been started.

This is a problem for pyreadline, which is often used to implement readline
support on Windows, as it does not attach to the correct handles for stdout
and/or stdin if they have been redirected by the FDCapture mechanism.  This
workaround ensures that readline is imported before I/O capture is setup so
that it can attach to the actual stdin/out for the console.

See https://github.com/pytest-dev/pytest/pull/1281