Closed doctaphred closed 2 years ago
Can you reproduce on latest master? There have been several improvements in adjacent code since 0.910.
I can't reproduce: I made a shell script that would clear cache and follow steps listed here and ran it ~15x -- nothing.
Nonetheless, perhaps this could use a .get
instead of indexing.
Here's the shell script, for completeness :P (I was on commit 4705576cb0875284de59e92b97044cb08e4c245c of the totpaas repository):
rm -r ./.mypy_cache
mypy totpaas
sed -i 's/from mintotp import hotp/from mintotp import hotp # type: ignore/' 'totpaas/main.py'
mypy totpaas
git checkout -- totpaas/main.py
Thanks for checking, A5rocks!!
Crash Report
I'm getting a strange traceback with missing source lines, semi-reproducibly, ending with
KeyError: 'type_guard'
.Traceback
Not sure why most source lines are omitted. (
--show-traceback
doesn't seem to affect this either way.)To Reproduce
Started using mypy with this project (don't ask). Ran
mypy totpaas
; got this output:Added
# type: ignore
to the offending line; re-ranmypy totpaas
; got the above traceback.Re-ran
mypy totpaas
a third time; got this output:I can semi-reliably reproduce this crash by trashing the
.mypy_cache
directory, reverting the code, and repeating the process above; but sometimes the crash doesn't happen. Attempts to isolate the issue in a minimal test file have so far been unsuccessful.Sometimes I can repro the crash by simply running
mypy totpaas
without either removing the.mypy_cache
directory or adding the# type: ignore
as described above; and sometimes even following those steps fully does not reliably repro it.Invoking mypy via
python -m pdb -m mypy totpaas
reliably prevents the crash.While encountering this issue, I've also noticed extremely long wait times for mypy and other terminal commands, so something else seems to be going on. Additionally, when opening a new iTerm tab (which I've configured to spawn a shell in the same working directory) from within the project directory, sometimes it does so normally; but other times, the new shell opens in
~/.Trash/totpaas 5.08.20 PM
. (I'd previously made a few additional clones of thetotpaas
repo in a different directory, and had subsequently moved them to the trash; no idea how they're getting confused for each other here, or which component could possibly be confusing them—iTerm? bash? the filesystem? macOS? some cache somewhere?)So, this might not be a mypy issue at all; but if not, hopefully it'll at least provide some Google food for future debuggers of the same underlying error.
Your Environment
mypy.ini
(and other config files): N/A