<feed xmlns='http://www.w3.org/2005/Atom'>
<title>suspect-devices/circuitpython/py/objarray.c, branch master</title>
<subtitle>CircuitPython - a Python implementation for teaching coding with microcontrollers</subtitle>
<id>https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=master</id>
<link rel='self' href='https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/'/>
<updated>2020-05-15T21:32:44+00:00</updated>
<entry>
<title>Make decode only apply to bytearray and not array as well</title>
<updated>2020-05-15T21:32:44+00:00</updated>
<author>
<name>Thea Flowers</name>
<email>me@thea.codes</email>
</author>
<published>2020-05-15T21:32:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=0876034adb8487f45c88224cb1ce29743848244e'/>
<id>urn:sha1:0876034adb8487f45c88224cb1ce29743848244e</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Add bytearray.decode() for CPython compatibility</title>
<updated>2020-05-15T04:52:58+00:00</updated>
<author>
<name>Thea Flowers</name>
<email>me@thea.codes</email>
</author>
<published>2020-05-15T04:16:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=fe3e8ee02c08e78691ebad293796985c9589824f'/>
<id>urn:sha1:fe3e8ee02c08e78691ebad293796985c9589824f</id>
<content type='text'>
CPython has a `decode()` method on `bytearray`. This adds that method using the code from `bytes.decode`.

Test program:

```python

byte_boi = bytes([0x6D, 0x65, 0x65, 0x70])
print(byte_boi)  # b'meep'
byte_boi_str = byte_boi.decode("utf-8")
print(byte_boi_str)  # meep

byte_array_boi = bytearray(byte_boi)
print(byte_array_boi)  # bytearray(b'meep')
byte_array_boi_str = byte_array_boi.decode("utf-8")
print(byte_array_boi_str)  # meep

print(byte_array_boi_str == byte_boi_str)  # True

```
</content>
</entry>
<entry>
<title>py changes for supporting superclass constructors that take kwargs</title>
<updated>2019-01-15T01:29:19+00:00</updated>
<author>
<name>Scott Shawcroft</name>
<email>scott@tannewt.org</email>
</author>
<published>2019-01-14T23:14:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=72d993d60c5e5238942491df00776ca31f9758a1'/>
<id>urn:sha1:72d993d60c5e5238942491df00776ca31f9758a1</id>
<content type='text'>
</content>
</entry>
<entry>
<title>LocalPeripheral is now Peripheral; more work on basic GATTS support; UART not working yet</title>
<updated>2018-12-31T03:33:49+00:00</updated>
<author>
<name>Dan Halbert</name>
<email>halbert@halwitz.org</email>
</author>
<published>2018-12-31T03:31:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=1dc3957e729a7bf4d6476c587f140e3d42fd1bd5'/>
<id>urn:sha1:1dc3957e729a7bf4d6476c587f140e3d42fd1bd5</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>WIP: after merge; before testing</title>
<updated>2018-07-11T20:45:30+00:00</updated>
<author>
<name>Dan Halbert</name>
<email>halbert@halwitz.org</email>
</author>
<published>2018-07-11T20:45:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=7c219600a246d8956d0b23ea3f5d125a820e6b6a'/>
<id>urn:sha1:7c219600a246d8956d0b23ea3f5d125a820e6b6a</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py/objarray: Replace 0x80 with new MP_OBJ_ARRAY_TYPECODE_FLAG_RW macro.</title>
<updated>2018-06-18T03:40:53+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-06-18T03:40:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=c00ee200accb0f79fc2a7829ebe4567258ed40c0'/>
<id>urn:sha1:c00ee200accb0f79fc2a7829ebe4567258ed40c0</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>
<entry>
<title>Implement * and *= for array.array</title>
<updated>2018-03-23T12:37:07+00:00</updated>
<author>
<name>Jeff Epler</name>
<email>jepler@unpythonic.net</email>
</author>
<published>2018-03-23T02:52:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=cdb83b18ece63b13d6796e315f0737f833c1ee16'/>
<id>urn:sha1:cdb83b18ece63b13d6796e315f0737f833c1ee16</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py/runtime: Add MP_BINARY_OP_CONTAINS as reverse of MP_BINARY_OP_IN.</title>
<updated>2017-11-24T03:48:23+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-11-24T02:04:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=5e34a113eaaf736fb4f703a3ee0892e1705d0a63'/>
<id>urn:sha1:5e34a113eaaf736fb4f703a3ee0892e1705d0a63</id>
<content type='text'>
Before this patch MP_BINARY_OP_IN had two meanings: coming from bytecode it
meant that the args needed to be swapped, but coming from within the
runtime meant that the args were already in the correct order.  This lead
to some confusion in the code and comments stating how args were reversed.
It also lead to 2 bugs: 1) containment for a subclass of a native type
didn't work; 2) the expression "{True} in True" would illegally succeed and
return True.  In both of these cases it was because the args to
MP_BINARY_OP_IN ended up being reversed twice.

To fix these things this patch introduces MP_BINARY_OP_CONTAINS which
corresponds exactly to the __contains__ special method, and this is the
operator that built-in types should implement.  MP_BINARY_OP_IN is now only
emitted by the compiler and is converted to MP_BINARY_OP_CONTAINS by
swapping the arguments.
</content>
</entry>
</feed>
