Fix deprecated “inspect.getargspec”

This commit is contained in:
Benjamin A. Beasley 2022-06-08 17:47:12 -04:00
parent 131fe89563
commit c95fe2799f
2 changed files with 44 additions and 0 deletions

30
29963.patch Normal file
View File

@ -0,0 +1,30 @@
From 56fd184b8db962a95574142aa2a8cf80df51bf6b Mon Sep 17 00:00:00 2001
From: "Benjamin A. Beasley" <code@musicinmybrain.net>
Date: Wed, 8 Jun 2022 17:03:51 -0400
Subject: [PATCH] =?UTF-8?q?Replace=20deprecated=20Python=20=E2=80=9Cinspec?=
=?UTF-8?q?t.getargspec=E2=80=9D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This has been deprecated since Python 3.0 and is removed in Python 3.11.
We can use “inspect.getfullargspec” instead.
Fixes #29962.
---
src/python/grpcio/grpc/_auth.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/python/grpcio/grpc/_auth.py b/src/python/grpcio/grpc/_auth.py
index 2d38320afff6..67113ceb5867 100644
--- a/src/python/grpcio/grpc/_auth.py
+++ b/src/python/grpcio/grpc/_auth.py
@@ -30,7 +30,7 @@ def __init__(self, credentials):
self._credentials = credentials
# Hack to determine if these are JWT creds and we need to pass
# additional_claims when getting a token
- self._is_jwt = 'additional_claims' in inspect.getargspec( # pylint: disable=deprecated-method
+ self._is_jwt = 'additional_claims' in inspect.getfullargspec(
credentials.get_access_token).args
def __call__(self, context, callback):

View File

@ -315,6 +315,20 @@ Patch: %{forgeurl}/pull/29568.patch
# Should install pkgconfig files under gRPC_INSTALL_LIBDIR
# https://github.com/grpc/grpc/issues/25635
Patch: %{forgeurl}/pull/29826.patch
# Replace deprecated Python “inspect.getargspec”
# https://github.com/grpc/grpc/pull/29963
#
# Fixes:
#
# Uses deprecated “inspect.getargspec”, removed in Python 3.11
# https://github.com/grpc/grpc/issues/29962
#
# Partially fixes:
#
# grpc fails to build with Python 3.11: AttributeError: module 'inspect' has no
# attribute 'getargspec'
# https://bugzilla.redhat.com/show_bug.cgi?id=2095027
Patch: %{forgeurl}/pull/29963.patch
Requires: grpc-data = %{version}-%{release}