jaraco / keyring

MIT License
1.24k stars 152 forks source link

devpi-client hook broken #596

Closed fschulze closed 1 year ago

fschulze commented 2 years ago

The @suppress(KeyringError) line breaks the devpi-client hook. It looks like the argument spec is changed by it which causes pluggy to not pass in the arguments correctly. It happens when trying to devpi push a release to pypi and the password is not set in ~pypirc which causes devpi-client to try the hook.

fschulze commented 2 years ago

It can more easily be triggered by devpi login username.

jaraco commented 1 year ago

I'm slightly surprised that the argument spec isn't present, because ContextDecorator uses functools.wraps.

jaraco commented 1 year ago

It looks like inspect.getfullargspec shows the raw args, but inspect.signature resolves the wrapping.

>>> inspect.getfullargspec(cl.devpiclient_get_password)
FullArgSpec(args=[], varargs='args', varkw='kwds', defaults=None, kwonlyargs=[], kwonlydefaults=None, annotations={})
>>> inspect.signature(cl.devpiclient_get_password)
<Signature (url, username)>
jaraco commented 1 year ago

Docs say that getfullargspec is discouraged and signature should be used:

Note that signature() and Signature Object provide the recommended API for callable introspection, and support additional behaviours (like positional-only arguments) that are sometimes encountered in extension module APIs. This function is retained primarily for use in code that needs to maintain compatibility with the Python 2 inspect module API.

jaraco commented 1 year ago

Oh, the issue is known (https://github.com/pytest-dev/pluggy/issues/358) and already linked to #582.

jaraco commented 1 year ago

v23.9.3 provides a workaround, but the core issue should be fixed upstream in pluggy.