-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Make shutil.rmtree.onexc
parameter optional
#12002
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@overload | ||
def __call__( | ||
self, path: StrOrBytesPath, ignore_errors: bool = False, *, onexc: _OnExcCallback, dir_fd: int | None = None | ||
self, | ||
path: StrOrBytesPath, | ||
ignore_errors: bool = False, | ||
*, | ||
onexc: _OnExcCallback | None = None, | ||
dir_fd: int | None = None, | ||
) -> None: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why we need this and the first overload. The first overload seems redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, given the params are kw only and optional. Good catch!
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
Noticed while adding pyright checks to setuptools (pypa/setuptools#4192)
Doc reference: https://docs.python.org/3/library/shutil.html#shutil.rmtree
I also tested locally that the parameter is indeed optional.
I also changed the
Exception
type in_OnExcCallback
forbaseException
so it works withExcInfo
:Argument 3 has incompatible type "BaseException"; expected "Exception"
xref pypa/setuptools#4382