Python 3.8 compatibility (#7754)

This commit is contained in:
mehrdadn
2020-04-01 10:03:23 -07:00
committed by GitHub
parent 24bf6ad607
commit 65054a2c7c
9 changed files with 87 additions and 46 deletions
+1 -1
View File
@@ -417,7 +417,7 @@ def _numpy_frombuffer(buffer, dtype, shape, order):
array = _frombuffer(buffer, dtype, shape, order)
# Unfortunately, numpy does not follow the standard, so we still
# have to set the readonly flag for it here.
array.setflags(write=not buffer.readonly)
array.setflags(write=isinstance(buffer, bytearray) or not buffer.readonly)
return array