Skip to content

pyrefly disagrees with pyright & mypy about some Tkinter code #769

@jepler

Description

@jepler

Describe the Bug

The following code is clean of diagnostics on mypy --strict and pyright but fails pyrefly check:

from tkinter import Tk

app = Tk()
def after_func() -> None:
    app.after(1000, after_func)

app.after_idle(after_func)

version info:

mypy 1.17.0 (compiled: yes)
pyright 1.1.403
pyrefly 0.25.1 # Artifact from #761

pyrefly says:

ERROR `() -> None` is not assignable to `(**tuple[*@_]) -> object` (caused by inconsistent types when breaking cycles) [bad-assignment]
 --> /home/jepler/test4.py:4:5
  |
4 | def after_func() -> None:
  |     ^^^^^^^^^^
  |
ERROR Argument `() -> None` is not assignable to parameter `func` with type `(**tuple[*@_]) -> object` in function `tkinter.Misc.after_idle` [bad-argument-type]
 --> /home/jepler/test4.py:7:16
  |
7 | app.after_idle(after_func)
  |                ^^^^^^^^^^
  |
 INFO 2 errors

Sandbox Link

https://pyrefly.org/sandbox/?code=GYJw9gtgBALg1gSwHYwKYigiAHMIZQAqcAUCQIbbZQC8RcAFAJQkAmqwU5waIA+sACuSAMbMoAWgB8UAHJgkqAFwkoarlQB03XgwCMABiMAaLj3QDhIlhS06LCVgBtUDe-yGiWQA

(Only applicable for extension issues) IDE Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions