[New-bugs-announce] [issue46067] SSLContext.set_npn_protocols broken in Python 3.10, tries to call non-existing _set_npn_protocols

Jonas Witschel report at bugs.python.org
Mon Dec 13 12:18:24 EST 2021


New submission from Jonas Witschel <git at diabonas.de>:

Consider the following minimal example:

import ssl
context = ssl.create_default_context()
context.set_npn_protocols(['http/1.1', 'spdy/2'])

In Python 3.10, it fails with the following error:

AttributeError: 'SSLContext' object has no attribute '_set_npn_protocols'. Did you mean: 'set_npn_protocols'?

This is because bpo-43669 (https://github.com/python/cpython/commit/39258d3595300bc7b952854c915f63ae2d4b9c3e) removed _set_npn_protocols, while it is still used by SSLContext.set_npn_protocols: https://github.com/python/cpython/blob/191c431de7d9b23484dd16f67e62c6e85a1fac7f/Lib/ssl.py#L551

Note that the function is already deprecated in Python 3.10 and throws a

DeprecationWarning: ssl NPN is deprecated, use ALPN instead

but should still probably continue working for now.

----------
assignee: christian.heimes
components: SSL
messages: 408466
nosy: christian.heimes, diabonas
priority: normal
severity: normal
status: open
title: SSLContext.set_npn_protocols broken in Python 3.10, tries to call non-existing _set_npn_protocols
type: compile error
versions: Python 3.10

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46067>
_______________________________________


More information about the New-bugs-announce mailing list