R1732(consider-using-with): Regression on contextlib.ExitStack
#9162
Labels
Needs triage 📥
Just created, needs acknowledgment, triage, and proper labelling
Bug description
This is extremely similar to #4654, but is somehow still flagged in my case.
I can see 2 possible distinctions.
I use
stack.enter_context(tempfile.TemporaryDirectory())
andstack.enter_context(tempfile.NamedTemporaryFile(...))
instead ofstack.enter_context(open(...))
as in the original issue.The
with contextlib.ExitStack
block is not directly in the same context/scope as wherestack.enter_context
is called.For example:
Configuration
see https://github.com/crim-ca/weaver/blob/master/.pylintrc
Command used
Pylint output
Expected behavior
No error for
stack.enter_context(tempfile.TemporaryDirectory())
andstack.enter_context(tempfile.NamedTemporaryFile(...))
.Pylint version
OS / Environment
Ubuntu 20.04.6
Additional dependencies
No response
The text was updated successfully, but these errors were encountered: