Jeff Epler 54d97251fe modstruct: Improve compliance with python3
While checking whether we can enable -Wimplicit-fallthrough, I encountered
a diagnostic in mp_binary_set_val_array_from_int which led to discovering
the following bug:
```
>>> struct.pack("xb", 3)
b'\x03\x03'
```
That is, the next value (3) was used as the value of a padding byte, while
standard Python always fills "x" bytes with zeros.  I initially thought
this had to do with the unintentional fallthrough, but it doesn't.
Instead, this code would relate to an array.array with a typecode of
padding ('x'), which is ALSO not desktop Python compliant:
```
>>> array.array('x', (1, 2, 3))
array('x', [1, 0, 0])
```
Possibly this is dead code that used to be shared between struct-setting
and array-setting, but it no longer is.

I also discovered that the argument list length for struct.pack
and struct.pack_into were not checked, and that the length of binary data
passed to array.array was not checked to be a multiple of the element
size.

I have corrected all of these to conform more closely to standard Python
and revised some tests where necessary.  Some tests for micropython-specific
behavior that does not conform to standard Python and is not present
in CircuitPython was deleted outright.
2020-09-12 14:07:23 -05:00
..
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-03-03 10:55:50 -08:00
2020-07-17 17:15:03 -07:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2019-04-05 21:38:32 +02:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-08-02 11:36:38 -04:00
2018-10-18 10:37:42 -07:00
2020-07-06 19:16:25 +01:00
2020-08-19 14:23:28 -07:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-13 22:54:52 -05:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2019-01-18 11:53:09 -08:00
2020-08-04 18:42:09 -05:00
2020-08-19 14:23:28 -07:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-08-04 18:42:09 -05:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-08-04 18:42:09 -05:00
2020-07-06 19:16:25 +01:00
2020-08-04 14:45:45 -05:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-08-02 11:36:38 -04:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2018-05-14 17:41:17 -04:00
2018-05-14 17:41:17 -04:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-04-21 22:40:12 -04:00
2020-04-21 22:40:12 -04:00
2020-08-21 11:00:02 -07:00
2020-08-21 11:00:02 -07:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00