[New-bugs-announce] [issue31859] sharedctypes.RawArray initialization

Tim report at bugs.python.org
Tue Oct 24 08:13:37 EDT 2017

New submission from Tim <tim.elberfeld at uantwerpen.be>:

In the initialization of a new `RawArray` the `size_or_initializer` parameter is tested for being an instance of `int`. When passing something like numpy.int64 here, the code crashes, because it does not recognize this as an integer. The workaround is to cast to int(). Wouldn't it be nicer to compare to types.IntType to allow for custom integer types?

def RawArray(typecode_or_type, size_or_initializer):
    Returns a ctypes array allocated from shared memory
    type_ = typecode_to_type.get(typecode_or_type, typecode_or_type)
-    if isinstance(size_or_initializer, int):
+    if size_or_initializer is IntType:

messages: 304902
nosy: meetaig
priority: normal
severity: normal
status: open
title: sharedctypes.RawArray initialization
type: behavior
versions: Python 3.5, Python 3.6

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list