Skip to content
Myr

Merge pull request #39 from erikrose/patch-1

Before adoption: this commit came in with the history the project adopted, so no landing records it.

A couple drive-by edits to the Python 2/3 docs

authored by Armin Ronacher · committed by Armin Ronacher · parents c0536c9, 7503e66 · Browse files · 1 file+6 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+6 added−6 removed

  • other:+6 added−6 removed

1 file+6 added−6 removed

modified:docs/python3.rst+6 added-6 removed
17 unmodified lines
1819At the moment click suffers from a few problems on Python 3:2021* The command line in Unix traditionally is in bytes and not unicode.22 While there are encoding hits for all of this, there are generally22 While there are encoding hints for all of this, there are generally23 some situations where this can break. The most common one is SSH24 connections to machines with different locales.2526 Misconfigured environments can currently cause a wide range of unicode27 problems on Python 3 due to the lack of support for roundtripping28 surrogate escapes. This will be fixed on a case by case basis going28 surrogate escapes. This will be fixed on a case-by-case basis going29 forward.3031* Standard input and output on Python 3 is opened in unicode mode by32 default. Click has to reopen the stream in binary mode in certain33 situations. Because there is no standardized way to do this, this34 might not always work. Primarily this can become a problem when35 testing command line applications.35 testing command-line applications.3637 This is not supported::3839 sys.stdin = io.StringIO('Input here')
33 unmodified lines
7374On Python 3 the following is true:7576* ``sys.stdin``, ``sys.stdout`` and ``sys.stderr`` are by default77 text-based. When click needs a binary stream it attempts to discover77 text-based. When click needs a binary stream, it attempts to discover78 the underlying binary stream. See :ref:`python3-limitations` for how79 this works.80* ``sys.argv`` is always unicode-based. This also means that the native81 type for input values to the types in click is unicode and not bytes.8283 This causes problems when the terminal is incorrectly set and Python84 does not figure out the encoding. In that case the unicode string85 will contain error bytes encoded as surrogate escapes.86* When dealing with files click will always use the unicode file system86* When dealing with files, click will always use the unicode file system87 API calls by using the operating system's reported or guessed88 filesystem encoding. Surrogates are supported for filenames so it88 filesystem encoding. Surrogates are supported for filenames, so it89 should be possible to open files through the :class:`File` type even90 if the environment is misconfigured.