8000 Reference leak in np.bincount with weights attribute · Issue #6805 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content
Reference leak in np.bincount with weights attribute #6805
Closed
@jaimefrio

Description

@jaimefrio

This code should illustrate what's going on

import sys
import numpy as np

intp_refcount = sys.getrefcount(np.dtype(np.intp))
double_refcount = sys.getrefcount(np.dtype(np.double))

for j in range(1000):
    np.bincount([1, 2, 3])

assert intp_refcount == sys.getrefcount(np.dtype(np.intp))
assert double_refcount == sys.getrefcount(np.dtype(np.double))

for j in range(1000):
    np.bincount([1, 2, 3], [4, 5, 6])

assert intp_refcount == sys.getrefcount(np.dtype(np.intp))  # this fails
assert double_refcount == sys.getrefcount(np.dtype(np.double))

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0