Open
Description
Bug Report
The original bug report is optuna/optuna#4404.
I tried to make a minimal reproducible example and found that checking the following code with the latest mypy takes about 1 minute.
To Reproduce
import numpy as np
from typing import Any
x: np.ndarray[Any, np.dtype[np.floating]] = np.asarray([1, 2, 3])
1 + x * (1 + x * (1 / 2 + x * (1 / 6 + x * (1 / 24 + x / 120))))
Adding terms as follows seems to increase execution time exponentially.
1 + x * (1 + x * (1 / 2 + x * (1 / 6 + x * (1 / 24 + x * (1 / 120 + x / 720)))))
Expected Behavior
The execution takes a few seconds.
Actual Behavior
$ time mypy exp.py
Success: no issues found in 1 source file
real 1m17.655s
user 0m55.657s
sys 0m0.892s
Your Environment
- Mypy version used: 1.1.1
- Mypy command-line flags: No flags
- Mypy configuration options from
mypy.ini
(and other config files): No configs - Python version used: 3.9.4