-
Notifications
You must be signed in to change notification settings - Fork 768
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
Unreachable after pow #3214
Comments
I believe that this has something to do with the first overload of @overload
def pow(base: int, exp: int, mod: Literal[0]) -> NoReturn: ... It's If you annotate your function's def RSAcompute(message, exponent, pubkey: int): I'm a little surprised by that given that @erictraut should be able to explain what's going on here. |
Thank you for the investigation from your side. I reported this because it was very annoying : all my code was grey underlined, that breaks the readability, makes it harder to code. And I was astonished by the cause. Sometimes, I even disabled real time language server in VScode to be able to read my code correctly. Of course, from a mathematical pov, the modulus can't be 0, because this is like a divisor. For the sake of curiosity, how can we specify this is a strictly positive integer ? (as it should) |
@debonte, your analysis is correct. The current type definition of @antonio-fr, the Python static type system isn't expressive enough to indicate a "strictly positive integer". It's able to express a type of |
The |
Working in cryptography, I often use the pow built-in method. I recently switched to pylance in VSCode. I investigated why it says that one of my scripts has "unreachable code", for half of the code base.
Environment data
Code Snippet
Expected behavior
Should know that the built-in function pow returns int or float. And should not trigger "unreachable code" when using the pow command.
Actual behavior
Flags anything following pow(...) as unreachable.
The text was updated successfully, but these errors were encountered: