-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
MyPy locks up when I try to process the file below.
To Reproduce
- Save the following snip of code as 'bug.py':
import json
config = {'x':{ 't': 'cat', 'z': 'e', 'c': [{ 't': 'cat', 'z': 'p', 'c': [{ 't': 'op', 'a': 0, 't': '', 'c': [{ 't': 'pod', 'a': 0, 'z': 'o', 'c': [{ 't': 'rp', 'a': 3, 'z': '', 'c': [{ 't': 'rp', 'a': 0, 'z': '', 'c': [{ 't': 'rp', 'a': 3, 'z': 'pes\' moy.', 'c': [{ 't': 'rp', 'a': 0, 'z': 'Ye!he s!', 'c': [{ 't': 'rp', 'a': 3, 'z': 'Wtht?', 'c': [{ 't': 'rp', 'a': 0, 'z': 'Sey? Yoon\'t vit?', 'c': [{ 't': 'rp', 'a': 3, 'z': 'Idn\'tn.', 'c': [{ 't': 'rp', 'a': 0, 'z': 'Weou\'reI\'mre.', 'c': [] },] },] },] },] },] },] },] },] },] },] },] },} - mypy bug.py
- Observe that it never finishes. Observe that cpu is at 100%. Observe that after a while, Ctrl-C does not stop it. But you can open another terminal and do "kill -15 [pid]" to stop it.
Expected Behavior
It should terminate in a timely manner.
Actual Behavior
It has not terminated after nearly 20 minutes.
`$ time mypy bug.py
^C^C^C^C^C^C^C^C^C^C^C^CTerminated
real 18m4.112s
user 17m55.106s
sys 0m8.776s`
If I remove the strings containing apostrophes from the file, it no longer repros. If I remove some of the nested objects, it also no longer repros. The file above is as simplified as I could make it while still reproducing the issue. When it locks up, my CPU runs at 100% capacity. If I press Ctrl-C soon after, it stops. But if I wait a while, then Ctrl-C will not interrupt it anymore, and I have to do "kill -15 [pid]" to stop it.
Your Environment
MyPy version 0.790. (It also repro'd with an earlier version of MyPy, so this does not appear to be a recent issue.)
Ubuntu 20.04.1 LTS