Or maybe it is an over site.
Can someone help me track down how CP implements this so i can look at the cosponsoring MP code that is around here:
https://github.com/micropython/micropyt ... uct.c#L215
Code: Select all
Python 3.6.9 (default, Jul 17 2020, 12:50:27)
>>> import struct
>>> struct.pack("H", 65536)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
struct.error: ushort format requires 0 <= number <= (0x7fff * 2 + 1)
Adafruit CircuitPython 5.3.1 on 2020-07-13; Adafruit CircuitPlayground Express with samd21g18
>>> import struct
>>> struct.pack("H", 65536)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: value must fit in 2 byte(s)
MicroPython v1.13 on 2020-09-07; Adafruit Feather STM32F405 with STM32F405RG
Type "help()" for more information.
>>> import struct
>>> struct.pack("H", 65536)
b'\x00\x00'