mirror of
https://github.com/python/cpython.git
synced 2025-11-02 22:51:25 +00:00
gh-133017: Improve error message for invalid typecodes in multiprocessing.{Array,Value} (GH-133252)
This commit is contained in:
parent
2cd24ebfe9
commit
f52de8a937
3 changed files with 22 additions and 1 deletions
|
|
@ -37,7 +37,12 @@
|
|||
#
|
||||
|
||||
def _new_value(type_):
|
||||
size = ctypes.sizeof(type_)
|
||||
try:
|
||||
size = ctypes.sizeof(type_)
|
||||
except TypeError as e:
|
||||
raise TypeError("bad typecode (must be a ctypes type or one of "
|
||||
"c, b, B, u, h, H, i, I, l, L, q, Q, f or d)") from e
|
||||
|
||||
wrapper = heap.BufferWrapper(size)
|
||||
return rebuild_ctype(type_, wrapper, None)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue