flake8-bugbear icon indicating copy to clipboard operation
flake8-bugbear copied to clipboard

Only emit B019 when `maxsize` is `None` in `lru_cache`?

Open lafrech opened this issue 3 years ago • 1 comments

Shouldn't B019 be emitted only when maxsize is None, as in https://github.com/PyCQA/pylint/pull/6181?

lafrech avatar Nov 15 '22 10:11 lafrech

Not sure about this. With a bounded size it's true that the memory leak is bounded, but it's still true that you can leak a reference to a (potentially big) object this way.

JelleZijlstra avatar Oct 28 '23 02:10 JelleZijlstra

JFYI , the mentions on this issue play out as a drama in three acts:

  1. Bugbear reported B019
  2. Seemed like a false positive ("transient memory leak seems fine") and was noqad.
  3. Actually was a true positive ("transient memory leak is actually problematic") and was fixed.

Seeing the noqa in code helped finding the root cause quickly.

+1 on closing this issue.

mrcljx avatar Jun 06 '24 07:06 mrcljx