Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak in code object lines and positions iterator #92955

Closed
kumaraditya303 opened this issue May 19, 2022 · 0 comments · Fixed by #92956
Closed

Memory leak in code object lines and positions iterator #92955

kumaraditya303 opened this issue May 19, 2022 · 0 comments · Fixed by #92956
Assignees
Labels
3.12 bugs and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs)

Comments

@kumaraditya303
Copy link
Contributor

The static types LineIterator and PositionsIterator in codeobject.c are not finalized at exit leading to memory leak.

Reproducer:

def func() -> None:
    pass

print(type(func.__code__.co_positions()).mro())
print(type(func.__code__.co_lines()).mro())

Memory leak:

[<class 'positions_iterator'>, <class 'object'>]
[<class 'line_iterator'>, <class 'object'>]
[138 refs, 54 blocks]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.12 bugs and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant