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-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-08-30 11:09:49 -05:00
2020-09-03 16:34:56 -07:00
2020-09-10 11:20:44 -07:00
2020-09-03 16:34:56 -07:00
2020-07-29 10:54:37 -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-23 20:40:16 -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
2018-04-10 15:06:47 +10:00
2020-07-06 19:16:25 +01:00
2018-04-10 15:06:47 +10:00
2018-04-10 15:06:47 +10:00
2018-05-04 20:39:16 +10:00
2018-04-10 15:06:47 +10: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
2018-01-24 10:33:46 -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-09-08 19:07:53 -05:00
2018-08-09 14:16:28 -07:00
2018-08-07 14:58:57 -07: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-06-25 20:57:17 -04: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-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-13 22:54:52 -05:00
2020-09-06 09:53:16 -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-08-25 11:47:50 -05:00
2020-09-03 16:34:56 -07:00
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
2019-01-18 11:53:09 -08:00
2020-08-04 18:42:09 -05: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-23 20:41:10 -07:00
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-09-06 09:53:16 -05:00
2020-09-06 09:53:16 -05:00
2020-09-06 09:53:16 -05:00
2020-09-06 09:53:16 -05: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-07-06 19:16:25 +01:00
2017-10-04 12:37:50 +11: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-08-04 14:45:45 -05:00
2020-07-22 16:26:46 -07:00
2020-07-06 19:16:25 +01: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-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-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00
2020-08-04 14:45:45 -05:00
2020-06-03 10:56:35 +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-08-12 07:32:18 -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
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-07-23 20:40:16 -07:00
2018-07-11 16:45:30 -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-06-03 10:56:35 +01:00
2017-08-25 22:17:07 -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
2020-07-06 19:16:25 +01:00
2020-07-06 19:16:25 +01:00