diff options
author | Jon Dufresne <jon.dufresne@gmail.com> | 2020-12-17 12:09:56 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-17 15:09:56 -0500 |
commit | 97cd4031549d363fa34737635eab33491fa718fe (patch) | |
tree | e11c7c55e578c3ce17b7851ba92cc0f91d947e12 /docs | |
parent | a1907c037a44e3dda54ea60163a15e11cfd81774 (diff) | |
download | pyjwt-97cd4031549d363fa34737635eab33491fa718fe.tar.gz |
Tighten bytes/str boundaries and remove unnecessary coercing (#547)
Now that the project is Python 3 only, the boundaries between bytes and
Unicode strings is more explicit.
This allows removing several unnecessary force_bytes() and
force_unicode() calls that handled differences between Python 2 and
Python 3. All uses of force_unicode() have been removed.
For values that are known to be bytes, use `.decode()` instead. For
values are that known to be str, use `.encode()` instead. This strategy
makes the type explicit and reduces a function call.
Key handling continues to use force_bytes() to allow callers to pass
either bytes or str.
To help enforce bytes/str handling in the future, the `-b` option is
passed to Python when testing. This option will emit a warning if bytes
and str are improperly mixed together.
Diffstat (limited to 'docs')
0 files changed, 0 insertions, 0 deletions