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
[Regression] field(default_factory=set) is miscompiled #917
Comments
Bisected to python/mypy@1bcfc04 by the way. |
3 tasks
cc @chadrik if you have time to take a look :-) |
ichard26
added a commit
to ichard26/mypy
that referenced
this issue
Jul 2, 2022
This also fixes mypyc/mypyc#917 RE above, the root issue is that mypyc didn't know builtins.set was a built-in name, so it guessed it comes from the module globals. This didn't blow up anything up somehow... until the dataclasses commit[^1] which made the __annotations__ logic for dataclasses try to better preserve the type annotations (previously they would be erased to builtins.type). [^1]: python@1bcfc04
ichard26
added a commit
to ichard26/mypy
that referenced
this issue
Jul 3, 2022
This also fixes mypyc/mypyc#917 RE above, the root issue is that mypyc didn't know builtins.set was a built-in name, so it guessed it comes from the module globals. This didn't blow up anything up somehow... until the dataclasses commit[^1] which made the `__annotations__` logic for dataclasses try to better preserve the type annotations (previously they would be erased to builtins.type). This new logic would use `load_type` to load `builtins.set` (so it can be put in `__annotations__`) whick went poorly as only types registered with `load_address_op` are considered built-ins. [^1]: python@1bcfc04
ichard26
added a commit
to ichard26/mypy
that referenced
this issue
Jul 3, 2022
This also fixes mypyc/mypyc#917 RE above, the root issue is that mypyc didn't know builtins.set was a built-in name, so it guessed it comes from the module globals. This didn't blow up anything up somehow... until the dataclasses commit[^1] which made the `__annotations__` logic for dataclasses try to better preserve the type annotations (previously they would be erased to builtins.type). This new logic would use `load_type` to load `builtins.set` (so it can be put in `__annotations__`) which went poorly as only types registered with `load_address_op` are considered built-ins. [^1]: python@1bcfc04
JelleZijlstra
pushed a commit
to python/mypy
that referenced
this issue
Jul 3, 2022
#13057) This also fixes mypyc/mypyc#917 RE above, the root issue is that mypyc didn't know builtins.set was a built-in name, so it guessed it comes from the module globals. This didn't blow up anything up somehow... until the dataclasses commit[^1] which made the `__annotations__` logic for dataclasses try to better preserve the type annotations (previously they would be erased to builtins.type). This new logic would use `load_type` to load `builtins.set` (so it can be put in `__annotations__`) which went poorly as only types registered with `load_address_op` are considered built-ins. [^1]: 1bcfc04
Gobot1234
pushed a commit
to Gobot1234/mypy
that referenced
this issue
Aug 12, 2022
python#13057) This also fixes mypyc/mypyc#917 RE above, the root issue is that mypyc didn't know builtins.set was a built-in name, so it guessed it comes from the module globals. This didn't blow up anything up somehow... until the dataclasses commit[^1] which made the `__annotations__` logic for dataclasses try to better preserve the type annotations (previously they would be erased to builtins.type). This new logic would use `load_type` to load `builtins.set` (so it can be put in `__annotations__`) which went poorly as only types registered with `load_address_op` are considered built-ins. [^1]: python@1bcfc04
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Given this code:
Compiling with
mypyc setfield.py
on 0.931 and then runningimport setfield
fails with:On 0.920 it works as expected.
Inspecting the C and the IR (thanks @ichard26) shows that we're incorrectly looking up
set
in the module globals instead of the builtins.The text was updated successfully, but these errors were encountered: