Python 3.11 changes
In [Packaging] Support Python 3.11 by bebound · Pull Request #26923 · Azure/azure-cli (github.com) , I bumped azure-cli to use Python 3.11. We’ve bump the dependency in other PRs, I thought it should be a small PR, but in the end, a lot of changes are made.
args.getargspec
getargspec
is dropped in 3.11. You can easily replaced it with getfullargspec
. It returns FullArgSpec(args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotations)
instead of ArgSpec(args, varargs, keywords, defaults)
So args, _, kw, _ = inspect.getargspec(fn)
can be replaced by args, _, kw, *_ = inspect.getfullargspec(fn)
However, getfullargspec
is retained primarily for use in code that needs to maintain compatibility with the Python 2 inspect
module API.