Repository navigation
Add the ssl OP_* and VERIFY_* constants missing from the ssl brain - #3444
Open
LindseyZ1205 wants to merge 2 commits into
Open
LindseyZ1205 wants to merge 2 commits into
LindseyZ1205 wants to merge 2 commits into
Conversation
ssl creates these constants at import time from _ssl, and the brain didn't list all of them as module attributes, so they were reported as missing members. OP_IGNORE_UNEXPECTED_EOF and OP_ENABLE_KTLS were also missing from the Options enum.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of Changes
Description
sslcreates itsOP_*andVERIFY_*constants at import time with_IntFlag._convert_(..., source=_ssl), so the ssl brain lists them. But several constants that the brain'sOptionsandVerifyFlagsenums already have aren't imported from_sslas module attributes, andOP_IGNORE_UNEXPECTED_EOF(new in Python 3.10) andOP_ENABLE_KTLS(new in Python 3.12) are missing from both. So pylint reports common settings such asas
E1101: Module 'ssl' has no 'OP_IGNORE_UNEXPECTED_EOF' member (no-member), andfrom ssl import OP_NO_TICKETasno-name-in-module. The affected names areOP_ENABLE_KTLS,OP_ENABLE_MIDDLEBOX_COMPAT,OP_IGNORE_UNEXPECTED_EOF,OP_NO_RENEGOTIATION,OP_NO_TICKET,OP_NO_TLSv1_3,VERIFY_ALLOW_PROXY_CERTS,VERIFY_X509_PARTIAL_CHAINandVERIFY_X509_TRUSTED_FIRST. I found them by writing out every public attribute that the stdlib modules have at runtime on Python 3.14 and running pylint'sno-memberon the result: these are the onlysslnames it reports.This change imports them from
_ssl, and addsOP_IGNORE_UNEXPECTED_EOFand, on Python 3.12+,OP_ENABLE_KTLStoOptions, as #2489 did forOP_LEGACY_SERVER_CONNECT. LikeOP_NO_COMPRESSIONandOP_SINGLE_ECDH_USE, which the brain already imports, some of these are only defined when OpenSSL has them (OP_IGNORE_UNEXPECTED_EOFandOP_ENABLE_KTLSneed OpenSSL 3.0), so the new test skips a name that the runningssldoesn't have. It doesn't touch thePROTOCOL_*imports that #3161 changes, and the two merge cleanly.Tests:
test_ssl_brain_options_and_verify_flagsintests/brain/test_ssl.pychecks that each name is inferred as a constant of the module and as a member of its enum. Its 9 cases fail onmainand pass with this change on Python 3.14 (OpenSSL 3.6), 3.13 and 3.12. With this change, pylintmainreports no errors for the snippets above. The whole test suite has 2470 passed with this change and 2461 onmain(Python 3.14); the same three tests intests/test_manager.pyandtests/test_get_relative_base_path.pyfail in both because of my local setup (Homebrew Python on macOS, withoutpkg_resources). ruff, black, pylint and mypy report nothing on the changed files.