-
Notifications
You must be signed in to change notification settings - Fork 3.3k
{Core} aaz: Wrap functools.partial in staticmethod() to remove FutureWarning
#31973
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
️✔️AzureCLI-FullTest
|
|
Hi @RenSilvaAU, |
️✔️AzureCLI-BreakingChangeTest
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
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.
Pull Request Overview
This PR adds staticmethod decorators to functools.partial calls to ensure compatibility with Python 3.13, which introduced breaking changes in how functools.partial handles static method binding. The change prevents runtime errors and maintains functionality across supported Python versions.
Key changes:
- Wraps existing
functools.partialcalls withstaticmethoddecorator for preview, experimental, and deprecation info attributes - Affects both command group and command decorators in the AAZ command framework
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
Please fix the PR title and lint error. Original error message when run Here is the related PR about this change: python/cpython#121092 |
Co-authored-by: Copilot <[email protected]>
aaz: wrap functools.partial in staticmethod() to remove FutureWarning
aaz: wrap functools.partial in staticmethod() to remove FutureWarningaaz: Wrap functools.partial in staticmethod() to remove FutureWarning
…FutureWarning (Azure#31973) Co-authored-by: Copilot <[email protected]>
…o remove FutureWarning (#32348)
Related command
az commandDescription
Added
staticmethodtofunctools.partialto ensure compatibility with Python 3.13.This change addresses a breaking behavior introduced in Python 3.13 where
functools.partialno longer supports static method binding without explicit declaration.The update ensures continued functionality across supported Python versions and prevents runtime errors in affected modules.
Testing Guide
Run unit tests for modules using
functools.partialas a static method.class MyClass:
@staticmethod
def my_method(x):
return x * 2
partial_func = staticmethod(functools.partial(MyClass.my_method, 5))
assert partial_func() == 10
Example:
import functools