Skip to content

linecache should remember files it failed to read and not try again #94436

@iritkatriel

Description

@iritkatriel

When linecache doesn't find a source file or fails to read it due to OSError, SyntaxError or UnicodeDecodeError, it returns an empty result. In subsequent attempts it would try to find and read the file again.

We should instead cache the negative lookup result and bypass the search in future queries.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.12only security fixesperformancePerformance or resource usagestdlibStandard Library Python modules in the Lib/ directory

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions