Skip to content
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

Avoid undefined LFS_TYPE_REG/DIR. #88

Merged
merged 2 commits into from
Mar 22, 2024

Conversation

Krakonos
Copy link
Contributor

It seems all versions of mypy between 1.0.1 and 1.9.0 crash due to this definition ( python/mypy#17059 ).

This seems to be a workaround. However, I'm not sure if the lfs.pyi is auto-generated or hand-written. There may be a better solution to this.

It seems all versions of mypy between 1.0.1 and 1.9.0 crash due to this
definition ( python/mypy#17059 ).
@BrianPugh
Copy link
Collaborator

I think this looks good to me; the pyi file is hand-crafted, but this assignment seems like an oversight. Thanks!

@BrianPugh
Copy link
Collaborator

so I'm holding off on this for a tiny bit, I think it may be more appropriate to change all of the value assignments in the pyi file to ellipsis (i.e. TYPE_REG: int = ...).

I'm running the following mypy on an M1 mac, and I'm unable to reproduce the crash mentioned in python/mypy#17059. I'll try some other things to see if I can reproduce.:

$ mypy --version
mypy 1.9.0 (compiled: yes)

@BrianPugh
Copy link
Collaborator

ok I'm able to reproduce, my environment was previously a lil messed up:

$ mypy --python-executable .venv/bin/python script.py
Traceback (most recent call last):
  File "/opt/homebrew/bin/mypy", line 8, in <module>
    sys.exit(console_entry())
             ^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/mypy/1.9.0/libexec/lib/python3.12/site-packages/mypy/__main__.py", line 15, in console_entry
    main()
  File "mypy/main.py", line 100, in main
  File "mypy/main.py", line 182, in run_build
  File "mypy/build.py", line 192, in build
  File "mypy/build.py", line 266, in _build
  File "mypy/build.py", line 2942, in dispatch
  File "mypy/build.py", line 3340, in process_graph
  File "mypy/build.py", line 3467, in process_stale_scc
  File "mypy/build.py", line 2503, in write_cache
  File "mypy/build.py", line 1564, in write_cache
  File "mypy/nodes.py", line 387, in serialize
  File "mypy/nodes.py", line 3933, in serialize
  File "mypy/nodes.py", line 3870, in serialize
  File "mypy/nodes.py", line 3278, in serialize
  File "mypy/nodes.py", line 3933, in serialize
  File "mypy/nodes.py", line 3865, in serialize
AssertionError: Definition of littlefs.lfs.LFSStat.TYPE_REG is unexpectedly incomplete

I'm going to try and replace stuff with ... and see if everything behaves as expected.

@BrianPugh
Copy link
Collaborator

Ok so, I've updated this PR so that ... gets assigned to those values.

I will not be changing the other default values in the stub, because some IDEs show that information, so may as well keep it (see python/typeshed#8988).

@BrianPugh BrianPugh merged commit dda2917 into jrast:master Mar 22, 2024
12 checks passed
@BrianPugh
Copy link
Collaborator

BrianPugh commented Mar 22, 2024

this has been released as part of v0.10.1

EDIT: hopefully will be released later today; there's some third-party CI stuff that is down at the moment preventing a release.

EDIT2: released.

@Krakonos
Copy link
Contributor Author

Thanks for the quick action, the new release works for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants