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