Merge "Switch get(full)argspec function according to python version"

This commit is contained in:
Zuul 2021-07-15 18:21:40 +00:00 committed by Gerrit Code Review
commit b04e7c2e53

View File

@ -935,9 +935,15 @@ def fake_http_connect(*code_iter, **kwargs):
if 'give_connect' in kwargs:
give_conn_fn = kwargs['give_connect']
argspec = inspect.getargspec(give_conn_fn)
if argspec.keywords or 'connection_id' in argspec.args:
ckwargs['connection_id'] = i
if six.PY2:
argspec = inspect.getargspec(give_conn_fn)
if argspec.keywords or 'connection_id' in argspec.args:
ckwargs['connection_id'] = i
else:
argspec = inspect.getfullargspec(give_conn_fn)
if argspec.varkw or 'connection_id' in argspec.args:
ckwargs['connection_id'] = i
give_conn_fn(*args, **ckwargs)
etag = next(etag_iter)
headers = next(headers_iter)