{Core} aaz: Wrap functools.partial in staticmethod() to remove FutureWarning#31973
{Core} aaz: Wrap functools.partial in staticmethod() to remove FutureWarning#31973
aaz: Wrap functools.partial in staticmethod() to remove FutureWarning#31973Conversation
️✔️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.
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 <175728472+Copilot@users.noreply.github.com>
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 <175728472+Copilot@users.noreply.github.com>
…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