Skip to content

Hang on some type hints #18928

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

Open
WiredBovine opened this issue Apr 15, 2025 · 1 comment
Open

Hang on some type hints #18928

WiredBovine opened this issue Apr 15, 2025 · 1 comment
Labels
bug mypy got something wrong performance

Comments

@WiredBovine
Copy link

Bug Report
mypy hangs and appears to have entered an infinite loop on some function argument type hints.

To Reproduce

The following code hangs mypy version 1.15.0 on my machine:

def normal_dist_intersection(m1: float | np.ndarray, m2: float | np.ndarray, s1: float | np.ndarray, s2: float | np.ndarray):
    return (m2*s1*s1 - s2 * (m1*s2 + s1*np.sqrt((m1 - m2)**2 + 2*(s1*s1 - s2*s2) * np.log(s1/s2)))) / (s1*s1 - s2*s2)

The following code works as expected. Note that the only difference is the removal of the last float type hint.

def normal_dist_intersection(m1: float | np.ndarray, m2: float | np.ndarray, s1: float | np.ndarray, s2: np.ndarray):
    return (m2*s1*s1 - s2 * (m1*s2 + s1*np.sqrt((m1 - m2)**2 + 2*(s1*s1 - s2*s2) * np.log(s1/s2)))) / (s1*s1 - s2*s2)

Your Environment

  • Mypy version used: 1.15.0
  • Mypy command-line flags: python -m mypy some/path/to/file/under/test.py
  • Mypy configuration options from mypy.ini (and other config files): None
  • Python version used: 3.11.11
@WiredBovine WiredBovine added the bug mypy got something wrong label Apr 15, 2025
@brianschubert
Copy link
Collaborator

Thanks! Looks similar to #14978

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong performance
Projects
None yet
Development

No branches or pull requests

2 participants