mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-22 03:41:28 +08:00
add annotation for multiprocessing.{Value,Array} with special c-types (#11833)
This commit is contained in:
14
test_cases/stdlib/check_multiprocessing.py
Normal file
14
test_cases/stdlib/check_multiprocessing.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from ctypes import c_char, c_float
|
||||
from multiprocessing import Array, Value
|
||||
from multiprocessing.sharedctypes import Synchronized, SynchronizedString
|
||||
from typing_extensions import assert_type
|
||||
|
||||
string = Array(c_char, 12)
|
||||
assert_type(string, SynchronizedString)
|
||||
assert_type(string.value, bytes)
|
||||
|
||||
field = Value(c_float, 0.0)
|
||||
assert_type(field, Synchronized[float])
|
||||
field.value = 1.2
|
||||
Reference in New Issue
Block a user