Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emit a deprecation warning for unsupported kwargs #776

Merged
merged 1 commit into from Jul 5, 2022

Commits on Jul 4, 2022

  1. Emit a deprecation warning for unsupported kwargs

    `**kwargs` usages cannot be removed without breaking backwards
    compatibility. Unsupported kwargs cannot even be rejected without
    breaking compatibility.
    
    However, this does not mean that the library cannot identify and
    warn when unsupported arguments are used. The warning behavior simply
    has to be separated from any removal of `**kwargs`.
    
    All legitimate `**kwargs` usages have been replaced with explicit
    arguments. Any other arguments will be captured under `**kwargs` and
    trigger the deprecation warnings. In the cases of
    `decode() -> decode_complete()` passthrough, the passthrough has been
    removed to avoid duplicate deprecation warnings on a single usage.
    
    This makes a very subtle behavioral change to `**kwargs` *only* for
    the case of a subclass of PyJWT or PyJWS. Extra arguments used by a
    specialized subclass won't pass through transparently anymore. In
    such a case the subclass author has multiple resolutions available,
    including reimplementation of the `decode()` method to passthrough
    the additional argument. Although technically backwards-incompatible
    for a niche subclassing usage, this behavior is very nearly identical
    and shouldn't pose an issue for the vast majority of pyjwt users.
    
    The deprecation warning does not cover all deprecated usages. In
    particular, several passthrough arguments for claim validation should
    probably be made available via `options` and later removed. The
    arguments in need of attention now have inline comments in the
    signature definitions, but are otherwise left unmodified, leaving
    current usages correct and valid.
    sirosen committed Jul 4, 2022
    Copy the full SHA
    a49b96e View commit details
    Browse the repository at this point in the history