Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Type information incorrect when @cached methods are passed as parameters #16606

Open
@clokep

Description

@clokep

If a method that is wrapped in @cached is passed into another function, e.g. run_in_background then the type information is incorrect; the current mypy plugin only updates the type information when it is called as a method, not when it is accessed as an attribute.

E.g. from #16590:

synapse/push/bulk_push_rule_evaluator.py:359: error: Missing positional argument "room_id" in call to "run_in_background"  [call-arg]
synapse/push/bulk_push_rule_evaluator.py:360: error: Argument 2 to "run_in_background" has incompatible type "str"; expected "RoomMemberWorkerStore"  [arg-type]

The method is not getting treated as bound (and there might be other issues too).

Metadata

Metadata

Assignees

No one assigned

    Labels

    O-UncommonMost users are unlikely to come across this or unexpected workflowS-MinorBlocks non-critical functionality, workarounds exist.T-DefectBugs, crashes, hangs, security vulnerabilities, or other reported issues.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions