AI junk#6037
Closed
Architect8989 wants to merge 1 commit into
Closed
Conversation
…amType The ssl module was only imported under TYPE_CHECKING but was referenced in the runtime class signature of CertParamType (click.ParamType[..., ssl.SSLContext]). With --future annotations, this should work, but click.ParamType is not subscriptable and the type argument triggers eager evaluation. Fix: import ssl unconditionally and remove the subscript from ParamType since it is not a generic type. Tests: 491 passed
|
Hi David... I am actually getting the exact same error running Flask-Security tests against latest main Flask... |
Member
|
Ok, please report an issue and if you want open a human written pr. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fix:
sslimport moved out ofTYPE_CHECKINGblockProblem
from flask.cli import CertParamTyperaisesNameError: name 'ssl' is not definedbecausesslis only imported underTYPE_CHECKING, but referenced in the class signature:Root Cause
Even with
from __future__ import annotations,click.ParamTypeis not subscriptable. The subscript causes eager evaluation of the type arguments at class definition time.Fix
import sslout of theif t.TYPE_CHECKING:block to the top-level importsclick.ParamType[...]since ParamType is not genericVerification
from flask import Flaskimports without error