2019-05-08 15:16:17 +01:00
|
|
|
try:
|
|
|
|
memoryview(b'a').itemsize
|
|
|
|
except:
|
|
|
|
print("SKIP")
|
|
|
|
raise SystemExit
|
2019-10-22 07:33:23 +01:00
|
|
|
try:
|
2022-08-18 07:57:45 +01:00
|
|
|
from array import array
|
2019-10-22 07:33:23 +01:00
|
|
|
except ImportError:
|
2022-08-18 07:57:45 +01:00
|
|
|
print("SKIP")
|
|
|
|
raise SystemExit
|
2019-05-08 15:16:17 +01:00
|
|
|
|
2019-12-13 04:38:03 +00:00
|
|
|
for code in ['b', 'h', 'i', 'q', 'f', 'd']:
|
2019-05-08 15:16:17 +01:00
|
|
|
print(memoryview(array(code)).itemsize)
|
2019-05-14 08:22:49 +01:00
|
|
|
|
2019-12-13 04:38:03 +00:00
|
|
|
# 'l' varies depending on word size of the machine
|
|
|
|
print(memoryview(array('l')).itemsize in (4, 8))
|
|
|
|
|
2019-05-14 08:22:49 +01:00
|
|
|
# shouldn't be able to store to the itemsize attribute
|
|
|
|
try:
|
|
|
|
memoryview(b'a').itemsize = 1
|
|
|
|
except AttributeError:
|
|
|
|
print('AttributeError')
|