Uh oh!
There was an error while loading. Please reload this page.
Fix crash on ParamSpec unification - #16251
Conversation
JelleZijlstra
commented
Oct 11, 2023
There's a slightly mysterious-looking test failure in a mypyc test. Possibly unrelated to this diff; let's see if it also happens on #12661 where I just retriggered CI. |
ilevkivskyi
commented
Oct 11, 2023
This comment has been minimized.
This comment has been minimized.
ilevkivskyi
commented
Oct 11, 2023
@JelleZijlstra It passed on retry LOL. Actually, I think it is the second time Python 3.8 MacOS randomly flakes during last week (and a different test case IIRC, but can't find logs now). |
rudolfix
commented
Oct 12, 2023
I also had segfault and this branch does not solve it. here's offending code here is part of stack trace (infinite recursion) seems some other function that you fixes is also affected here's the minimum modification of the code above that prevents segfault hope this helps |
sobolevn
commented
Oct 12, 2023
No, it still fails with: https://github.com/dry-python/returns/actions/runs/6492022546/job/17630240757?pr=1702 At least, I can see the traceback now :) |
ilevkivskyi
commented
Oct 12, 2023
Oops, yes, same thing for plain callables (I will also do a small refactoring while I am at this). |
Diff from mypy_primer, showing the effect of this PR on open source code: discord.py (https://github.com/Rapptz/discord.py)
- discord/app_commands/commands.py:2381: error: "Callable[..., Coroutine[Any, Any, Any]]" has no attribute "__discord_app_commands_checks__" [attr-defined]- discord/app_commands/commands.py:2383: error: "Callable[..., Coroutine[Any, Any, Any]]" has no attribute "__discord_app_commands_checks__" [attr-defined]+ discord/app_commands/commands.py:2381: error: Item "function" of "Callable[[Any, Interaction[Any], VarArg(Any), KwArg(Any)], Coroutine[Any, Any, Any]] | Callable[[Interaction[Any], VarArg(Any), KwArg(Any)], Coroutine[Any, Any, Any]]" has no attribute "__discord_app_commands_checks__" [union-attr]+ discord/app_commands/commands.py:2383: error: Item "function" of "Callable[[Any, Interaction[Any], VarArg(Any), KwArg(Any)], Coroutine[Any, Any, Any]] | Callable[[Interaction[Any], VarArg(Any), KwArg(Any)], Coroutine[Any, Any, Any]]" has no attribute "__discord_app_commands_checks__" [union-attr] |
AlexWaygood
commented
Oct 12, 2023
Happy to confirm that this fixes the typeshed crash! I tested by installing this PR branch into a venv with all of typeshed's other test requirements, making this change to --- a/tests/utils.py+++ b/tests/utils.py@@ -83,8 +83,8 @@ def make_venv(venv_dir: Path) -> VenvInfo:
@cache
def get_mypy_req() -> str:
- with open("requirements-tests.txt", encoding="UTF-8") as requirements_file:- return next(strip_comments(line) for line in requirements_file if "mypy" in line)+ return "git+https://github.com/ilevkivskyi/mypy.git@fix-paramspec-regression"+ |
ilevkivskyi
commented
Oct 12, 2023
rudolfix
commented
Oct 12, 2023
@ilevkivskyi yeah now it works! thank you for quick fix! |
ilevkivskyi
commented
Oct 12, 2023
I tried |
Fixes#16245Fixes#16248 Unfortunately I was a bit reckless with parentheses, but in my defense `unify_generic_callable()` is kind of broken for long time, as it can return "solutions" like ```{1: T`1}```. We need a more principled approach there (IIRC there is already an issue about this in the scope of `--new-type-inference`). (The fix is quite trivial so I am not going to wait for review too long to save time, unless there will be some issues in `mypy_primer` etc.)
Fixes#16245
Fixes#16248
Unfortunately I was a bit reckless with parentheses, but in my defense
unify_generic_callable()is kind of broken for long time, as it can return "solutions" like{1: T`1}. We need a more principled approach there (IIRC there is already an issue about this in the scope of--new-type-inference).(The fix is quite trivial so I am not going to wait for review too long to save time, unless there will be some issues in
mypy_primeretc.)