inspect module caches can grow without bound
Open
Nobody has claimed this yet.
stdlib
type-bug
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
inspect.getmodule uses these dicts as caches:
modulesbyfile = {}
_filesbymodname = {}
In #116731, we might make refleak tests clear/ignore the caches. But that's not entirely correct: they could grow without bound, with dynamically created files/modules.
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 inspect.getmodule and the modulesbyfile and _filesbymodname cache definitions. Review how dynamically created files and modules enter these dictionaries, then examine the refleak tests mentioned in #116731; done means the caches no longer grow without bound while module inspection remains correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100