-
Notifications
You must be signed in to change notification settings - Fork 71
Do not use mutable default arguments #800
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
Do not use mutable default arguments #800
Conversation
Using mutable default arguments is a common Python problem, see e.g. https://docs.python-guide.org/writing/gotchas/#mutable-default-arguments In this specific case the default argument even tries to setup some infrastructure settings at import time, which can potentially fail. Note that this commit is changing the behavior for user passing in `None` to the changed method, as it will now create an `AsyncClient` with the options specified within the module. In the previous behavior it would have raised an exception deeper down the call stack (see http://github.com/microsoft/kiota-http-python/pull/383/files).
Note that this PR is done together with: |
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.
Thanks for the contribution!
@marlamb can you also replicate the change to https://github.com/microsoftgraph/msgraph-beta-sdk-python please? |
@baywet I would, but you were faster 😄 . Out of curiosity: what is the reason why it triggered releases on all repositories except for |
For core I found a defect in the release please configuration microsoftgraph/msgraph-sdk-python-core#628 For V1 and beta I ran into a defect with dependencies configuration which prevents the release. All those caused by recent changes in the automation. |
Thanks for the explanation, crossing fingers that you can fix the defects and looking forward to the releases! |
yes, service libraries were just released yesterday and today |
Using mutable default arguments is a common Python problem, see e.g. https://docs.python-guide.org/writing/gotchas/#mutable-default-arguments
In this specific case the default argument even tries to setup some infrastructure settings at import time, which can potentially fail.
Note that this commit is changing the behavior for user passing in
None
to the changed method, as it will now create anAsyncClient
with the options specified within the module. In the previous behavior it would have raised an exception deeper down the call stack (see http://github.com/microsoft/kiota-http-python/pull/383/files).