mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-117174: Fix reference leak and gdb tests (#131095)
This commit is contained in:
parent
c00ac57824
commit
ebc24d54bc
8 changed files with 88 additions and 83 deletions
|
@ -51,9 +51,11 @@ def _getline_from_code(filename, lineno):
|
|||
return lines[lineno - 1]
|
||||
return ''
|
||||
|
||||
def _make_key(code):
|
||||
return (code.co_filename, code.co_qualname, code.co_firstlineno)
|
||||
|
||||
def _getlines_from_code(code):
|
||||
code_id = id(code)
|
||||
code_id = _make_key(code)
|
||||
if code_id in _interactive_cache:
|
||||
entry = _interactive_cache[code_id]
|
||||
if len(entry) != 1:
|
||||
|
@ -215,7 +217,6 @@ def lazycache(filename, module_globals):
|
|||
return True
|
||||
return False
|
||||
|
||||
|
||||
def _register_code(code, string, name):
|
||||
entry = (len(string),
|
||||
None,
|
||||
|
@ -227,4 +228,4 @@ def _register_code(code, string, name):
|
|||
for const in code.co_consts:
|
||||
if isinstance(const, type(code)):
|
||||
stack.append(const)
|
||||
_interactive_cache[id(code)] = entry
|
||||
_interactive_cache[_make_key(code)] = entry
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue