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

Remove unused compat shim for 'bytes' #1195

Merged
merged 1 commit into from Dec 31, 2018

Conversation

Projects
None yet
3 participants
@jdufresne
Copy link
Contributor

jdufresne commented Dec 28, 2018

Never used. Both Python 2.7 and Python 3 have the type bytes. On Python
2.7 it is an alias for str, same as what was previously defined.

Remove unused compat shim for 'bytes'
Never used. Both Python 2.7 and Python 3 have the type bytes. On Python
2.7 it is an alias for str, same as what was previously defined.
@Julian

This comment has been minimized.

Copy link

Julian commented Dec 31, 2018

Not a click author, but seems to me that it's unlikely that the point of that line was to be "useful", otherwise the next line (raw_input = raw_input) is even more transparently pointless.

I suspect instead that the point is to explicitly list each cross-compatible name that is to be made available.

@jdufresne

This comment has been minimized.

Copy link
Contributor Author

jdufresne commented Dec 31, 2018

The next line raw_input = raw_input is required as Python 2 & 3 have differences in input handling. See:

https://docs.python.org/3/whatsnew/3.0.html#builtins

PEP 3111: raw_input() was renamed to input(). That is, the new input() function reads a line from sys.stdin and returns it with the trailing newline stripped. It raises EOFError if the input is terminated

The raw_input needs to be always be importable from _compat.py to make this transparent to uses in click.

This is not true of bytes. Both Python 2 & 3 have the type bytes. So there is no need to define it explicitly as a compatability shim. Observe:

$ python2
>>> bytes
<type 'str'>

bytes is never imported from _compat.py.

Therefore, I still believe this is a cleanup of unused code.

@davidism davidism merged commit 6cf69b7 into pallets:master Dec 31, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@davidism davidism added this to the 8.0 milestone Dec 31, 2018

@jdufresne jdufresne deleted the jdufresne:bytes branch Dec 31, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.