Skip to content

Typing of multiprocessing.Value broken since mypy 0.981 #8799

Closed
@prauscher

Description

@prauscher

Hello everyone,

after updating to mypy 0.981, i received a mypy error for multiprocessing.Value:

from multiprocessing import Value
import ctypes

mapper = Value(ctypes.c_float, float("nan"))
mapper.value = 2.3  # error: "SynchronizedBase[c_float]" has no attribute "value"

As far as I can tell, the issue is that Value() gives a SynchronizedBase which is not typed to have a value attribute. Synchronized however would offer this attribute, as it is present in the real world.

Am I missing something or should

def Value(self, typecode_or_type: type[_CT], *args: Any, lock: Literal[True] | _LockLike = ...) -> SynchronizedBase[_CT]: ...
be changed to Synchronized instead of SynchronizedBase ?

Update: The issue was not there in 0.971 and is now present in 0.981

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: regressionSomething that worked before doesn't work anymorestubs: false positiveType checkers report false errors

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions