The following:
from ssl import Options
reveal_type(Options.OP_NO_SSLv2)
reveal_type(Options.OP_ALL)
def f(a: Options) -> None: ...
f(Options.OP_NO_SSLv2)
f(Options.OP_ALL)
When run through mypy 2.3.1 it reports:
/tmp/ramdisk/test.py:3: note: Revealed type is "Literal[ssl.Options.OP_NO_SSLv2]?"
/tmp/ramdisk/test.py:4: note: Revealed type is "int"
/tmp/ramdisk/test.py:8: error: Argument 1 to "f" has incompatible type "int"; expected "Options" [arg-type]
Found 1 error in 1 file (checked 1 source file)
When run through pyright 1.1.413 it reports:
/tmp/ramdisk/test.py
/tmp/ramdisk/test.py:3:13 - information: Type of "Options.OP_NO_SSLv2" is "Literal[Options.OP_NO_SSLv2]"
/tmp/ramdisk/test.py:4:13 - information: Type of "Options.OP_ALL" is "int"
/tmp/ramdisk/test.py:8:3 - error: Argument of type "int" cannot be assigned to parameter "a" of type "Options" in function "f"
"int" is not assignable to "Options" (reportArgumentType)
1 error, 0 warnings, 2 informations
I believe the error is in ssl.py in the definition of OP_ALL, where it should probably be instead:
The following:
When run through mypy 2.3.1 it reports:
When run through pyright 1.1.413 it reports:
I believe the error is in ssl.py in the definition of OP_ALL, where it should probably be instead: