<feed xmlns='http://www.w3.org/2005/Atom'>
<title>suspect-devices/circuitpython/py/binary.c, branch 6.2.x</title>
<subtitle>CircuitPython - a Python implementation for teaching coding with microcontrollers</subtitle>
<id>https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=6.2.x</id>
<link rel='self' href='https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=6.2.x'/>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/'/>
<updated>2021-03-15T13:57:36+00:00</updated>
<entry>
<title>run code formatting script</title>
<updated>2021-03-15T13:57:36+00:00</updated>
<author>
<name>microDev</name>
<email>70126934+microDev1@users.noreply.github.com</email>
</author>
<published>2021-03-15T13:57:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=a52eb88031620a81521b937f2a0651dbac2bb350'/>
<id>urn:sha1:a52eb88031620a81521b937f2a0651dbac2bb350</id>
<content type='text'>
</content>
</entry>
<entry>
<title>modstruct: Improve compliance with python3</title>
<updated>2020-09-12T19:07:23+00:00</updated>
<author>
<name>Jeff Epler</name>
<email>jepler@gmail.com</email>
</author>
<published>2020-09-12T18:57:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=54d97251fe2dd4939652a186bf703885e654b4d1'/>
<id>urn:sha1:54d97251fe2dd4939652a186bf703885e654b4d1</id>
<content type='text'>
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:
```
&gt;&gt;&gt; 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:
```
&gt;&gt;&gt; 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.
</content>
</entry>
<entry>
<title>Add license to some obvious files.</title>
<updated>2020-07-06T18:16:25+00:00</updated>
<author>
<name>Diego Elio Pettenò</name>
<email>flameeyes@flameeyes.com</email>
</author>
<published>2020-06-03T22:40:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=34b4993d63a6b576f29d624385c681f679b4124c'/>
<id>urn:sha1:34b4993d63a6b576f29d624385c681f679b4124c</id>
<content type='text'>
</content>
</entry>
<entry>
<title>mp_binary_get_int: avoid undefined behavior</title>
<updated>2019-10-08T01:48:25+00:00</updated>
<author>
<name>Jeff Epler</name>
<email>jepler@gmail.com</email>
</author>
<published>2019-10-08T01:48:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=0d96f1906b66139beebc13c55078aaf610c76968'/>
<id>urn:sha1:0d96f1906b66139beebc13c55078aaf610c76968</id>
<content type='text'>
Left shift of negative numbers is undefined in the "C" standard.  Multiplying
by 256 has the intended effect (in the absence of integer overflow, anyway),
can be implemented using the same shift instruction, but does not invoke
undefined behavior.

This problem was found using clang 7's scan-build static analyzer.
</content>
</entry>
<entry>
<title>Handle truth values; speed up smallint checks</title>
<updated>2019-05-12T04:10:53+00:00</updated>
<author>
<name>Dan Halbert</name>
<email>halbert@halwitz.org</email>
</author>
<published>2019-05-12T04:10:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=d103ac1d6325a075be3fafe812858584435f3144'/>
<id>urn:sha1:d103ac1d6325a075be3fafe812858584435f3144</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Add overflow checks for int to bytes conversions</title>
<updated>2019-05-09T07:22:25+00:00</updated>
<author>
<name>Matt Wozniski</name>
<email>godlygeek+git@gmail.com</email>
</author>
<published>2019-05-09T03:50:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=095c844004bcd8680a4bf68901adbd9cac6a4302'/>
<id>urn:sha1:095c844004bcd8680a4bf68901adbd9cac6a4302</id>
<content type='text'>
For both small and long integers, raise an exception if calling
struct.pack, adding an element to an array.array, or formatting an int
with int.to_bytes would overflow the requested size.
</content>
</entry>
<entry>
<title>Improve struct compatibility with CPython</title>
<updated>2019-01-20T20:12:34+00:00</updated>
<author>
<name>Dan Halbert</name>
<email>halbert@halwitz.org</email>
</author>
<published>2019-01-20T20:10:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=7a09af73ec7f4a11a1404dff6276e09072d06983'/>
<id>urn:sha1:7a09af73ec7f4a11a1404dff6276e09072d06983</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Two fixes and translate more strings.</title>
<updated>2018-08-09T20:29:30+00:00</updated>
<author>
<name>Scott Shawcroft</name>
<email>scott@tannewt.org</email>
</author>
<published>2018-08-09T01:24:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=96ebf5bc3fb455162286b9bc31e763f3c4f1c457'/>
<id>urn:sha1:96ebf5bc3fb455162286b9bc31e763f3c4f1c457</id>
<content type='text'>
* Fix finding translations with escaped characters.
* Add back \r to translations since its needed by screen.
</content>
</entry>
<entry>
<title>merge finished</title>
<updated>2018-07-28T17:29:47+00:00</updated>
<author>
<name>Dan Halbert</name>
<email>halbert@halwitz.org</email>
</author>
<published>2018-07-28T17:29:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=f48b70050e3e4122eaae3eee47d35fc30bda2a4c'/>
<id>urn:sha1:f48b70050e3e4122eaae3eee47d35fc30bda2a4c</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Conditionally compile out nonstandard array/struct typecodes</title>
<updated>2018-03-26T23:13:49+00:00</updated>
<author>
<name>Jeff Epler</name>
<email>jepler@unpythonic.net</email>
</author>
<published>2018-03-26T23:13:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=355bf8b5538b4fe2f9f07b0d8fb2f4500c2f96c6'/>
<id>urn:sha1:355bf8b5538b4fe2f9f07b0d8fb2f4500c2f96c6</id>
<content type='text'>
.. defaulting to off for circuitpython-supported boards, on for others.

.. fixing up the tests that fail when it is turned off, so that they skip
instead of failing
</content>
</entry>
</feed>
