Describe the Bug
Here's the example code:
import shutil
from contextlib import ExitStack
def foo(tmpdir):
with ExitStack() as resources:
resources.callback(shutil.rmtree, tmpdir, ignore_errors=True)
def bar(tmpdir):
shutil.rmtree(tmpdir, ignore_errors=True)
and the output of pyrefly check example.py:
ERROR Missing argument `onerror` in function `contextlib._BaseExitStack.callback` [missing-argument]
--> example.py:7:27
|
7 | resources.callback(shutil.rmtree, tmpdir, ignore_errors=True)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
INFO 1 error
What's odd to me is that pyrefly complains about onerror (which clearly is a default argument), but only when called through ExitStack.callback. When called explicitly, pyrefly (correctly, IMHO) accepts the call with the missing onerror argument.
% pyrefly --version
pyrefly 0.48.0
Sandbox Link
No response
(Only applicable for extension issues) IDE Information
No response
Describe the Bug
Here's the example code:
and the output of
pyrefly check example.py:What's odd to me is that pyrefly complains about
onerror(which clearly is a default argument), but only when called throughExitStack.callback. When called explicitly, pyrefly (correctly, IMHO) accepts the call with the missingonerrorargument.Sandbox Link
No response
(Only applicable for extension issues) IDE Information
No response