SIM115
false positive when using open()
inside of a custom context manager __enter__
#11567
Labels
bug
Something isn't working
Keywords:
SIM115
,__enter__
, context managerWhen writing your own context manager, which internally uses another context manager (like
open
), SIM115 suggests using awith
block when this is not possible (as the goal is to open the resource in__enter__
, and keep it open).I would expect/hope the behaviour be to automatically suppress this check within an
__enter__
block, as (in my experience) it is often the case that these blocks delegate some of the handling to e.g.open()
Code snippet:
Command invoked:
Ruff version: 0.4.5
Configuration:
The text was updated successfully, but these errors were encountered: