Skip to content

IDLE editor crashes opening a file with million+ character lines #103089

Description

@AlexWaygood

Bug report

IDLE crashes if you try to open a .py file with ridiculously long nested dicts in it.

To reproduce

  1. Copy and paste the contents of this file into a .py file: repro.txt
  2. Attempt to open the file with IDLE.

Observed behaviour

The first time I tried doing this, IDLE opened the file, but then immediately crashed. All subsequent times I have tried doing this, Python has hanged on me requesting IDLE to open the file. (I don't know how long it hangs for; I've interrupted it using CTRL-C every time.)

Comments

This is pretty weird code. The reason why it's so weird is that it's partially generated code: it's the result of a codemod by stubdefaulter.

IDLE is far from the only tool that crashes or hangs when encountering this code. This code also causes black, flake8 and mypy to hang indefinitely. VSCode does open the file, and has no performance issues, but it takes a very long time for pyright's analysis of the file to complete in the background when you open the file with VSCode.

Your environment

  • CPython versions tested on:
    • 3.11.2
    • CPython main branch @ 7703def
  • Operating system and architecture: Windows

Linked PRs

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

topic-IDLEtype-bugAn unexpected behavior, bug, or error

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions