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

cadata param can (and PEM-encoded cadata must) be unicode under PY2 #3150

Merged
merged 4 commits into from Aug 23, 2019
Merged

cadata param can (and PEM-encoded cadata must) be unicode under PY2 #3150

merged 4 commits into from Aug 23, 2019

Commits on Jul 26, 2019

  1. cadata param can (and PEM-encoded cadata must) be unicode under PY2

    The documentation for that parameter states: "The cadata object, if
    present, is either an ASCII string of one or more PEM-encoded
    certificates or a bytes-like object of DER-encoded certificates."
    Similar wording is used for PY2 and PY3. But that's a bit of a
    backporting bug in the documentation, since "ASCII string" and
    "bytes-like object" sound like they could both be str under PY2. In
    fact, if the type is str it's assumed to be DER-encoded and
    PEM-encoded cadata must use the unicode type under PY2
    (https://bugs.python.org/issue37079):
    https://github.com/python/cpython/blob/2149a9ad/Modules/_ssl.c#L3011
    
    Thus, these type declarations should use Union[Text, bytes, None]
    instead of Union[str, bytes, None].
    
    Also, _create_unverified_context exists in Python 2:
    https://github.com/python/cpython/blob/2149a9ad/Lib/ssl.py#L448
    sfreilich committed Jul 26, 2019
    Configuration menu
    Copy the full SHA
    2e24ec2 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    db3be5b View commit details
    Browse the repository at this point in the history

Commits on Aug 13, 2019

  1. Configuration menu
    Copy the full SHA
    f02f54d View commit details
    Browse the repository at this point in the history
  2. Add a misplaced space

    sfreilich committed Aug 13, 2019
    Configuration menu
    Copy the full SHA
    cc1f076 View commit details
    Browse the repository at this point in the history