Skip to content

pdb crashes with "ValueError: I/O operation on closed file." when exit() is called. #153820

Description

@rai42

Bug report

Bug description:

test.py:

print("Hello")
exit()

To reproduce: run with (*)
$ pdb3 test.py
or
$ python3 -m pdb test.py
enter command 'c' to run

(* or pdb / python depending on installation)

Result: The program runs to completion but then pdb crashes with "ValueError: I/O operation on closed file."

Full output:
output.txt

Reproduced with 3.12.3 on Linux and 3.10.4 on Windows.
It happens only in the debugger and only when exit() is called, and regardless of a status code passed to exit().

CPython versions tested on:

3.12

Operating systems tested on:

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions