linecache should remember files it failed to read and not try again
Open
Nobody has claimed this yet.
3.12
performance
stdlib
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 36k
- PR merge metrics
- PR metrics pending
Description
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
- gh-121224
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the linecache entry point described in the issue and inspect how missing or unreadable files are handled. Confirm that a failed lookup is remembered so later queries bypass the search and return the same empty result; check the linked PR gh-121224 for work already in progress.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 25/100