Skip to content

Memory leak if math.dist raises exception #98897

Closed

Description

@kumaraditya303

Reproducer:

import math
try:
    math.dist([1, 2], [3, 4, 5])
except ValueError:
    pass

Memory leak:

@kumaraditya303 ➜ /workspaces/cpython (main ✗) $ ./python -X showrefcount main.py 
[7 refs, 2 blocks]

Python Version: main at 9bdec0a

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    3.11only security fixes
    3.12only security fixes
    on Oct 31, 2022
  2. vstinner commented on Oct 31, 2022

    @vstinner
    Member

    I'm glad that ./python -X showrefcount can now be used to detect memory leaks at exit :-) https://mail.python.org/archives/list/python-dev@python.org/thread/E4C6TDNVDPDNNP73HTGHN5W42LGAE22F/

  3. vstinner commented on Oct 31, 2022

    @vstinner
    Member

    Do you want to propose a fix?

  4. self-assigned this
    on Oct 31, 2022
  5. added a commit that references this issue on Nov 1, 2022
  6. added 2 commits that reference this issue on Nov 1, 2022
  7. added 2 commits that reference this issue on Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

3.10 (EOL)end of life3.11only security fixes3.12only security fixeseasytype-bugAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions