<feed xmlns='http://www.w3.org/2005/Atom'>
<title>suspect-devices/circuitpython/py/objtype.c, branch v1.9.4</title>
<subtitle>CircuitPython - a Python implementation for teaching coding with microcontrollers</subtitle>
<id>https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=v1.9.4</id>
<link rel='self' href='https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=v1.9.4'/>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/'/>
<updated>2018-02-07T04:44:29+00:00</updated>
<entry>
<title>py/objtype: Check and prevent delete/store on a fixed locals map.</title>
<updated>2018-02-07T04:44:29+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-02-07T04:44:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=b45c8c17f0f295e919a90659d4c1880a47b228c1'/>
<id>urn:sha1:b45c8c17f0f295e919a90659d4c1880a47b228c1</id>
<content type='text'>
Note that the check for elem!=NULL is removed for the
MP_MAP_LOOKUP_ADD_IF_NOT_FOUND case because mp_map_lookup will always
return non-NULL for such a case.
</content>
</entry>
<entry>
<title>py/objtype: Refactor object's handling of __new__ to not create 2 objs.</title>
<updated>2017-12-12T05:53:44+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-12-12T04:22:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=c78ef92d787d7bab8acbec69e978037ec2b20d21'/>
<id>urn:sha1:c78ef92d787d7bab8acbec69e978037ec2b20d21</id>
<content type='text'>
Before this patch, if a user defined the __new__() function for a class
then two instances of that class would be created: once before __new__ is
called and once during the __new__ call (assuming the user creates some
instance, eg using super().__new__, which is most of the time).  The first
one was then discarded.  This refactor makes it so that a new instance is
only created if the user __new__ function doesn't exist.
</content>
</entry>
<entry>
<title>py/objtype: Implement better support for overriding native's __init__.</title>
<updated>2017-12-12T05:43:16+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-11-29T23:31:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=d32d22dfd79439e07739166eaa3f7e41466c7ec8'/>
<id>urn:sha1:d32d22dfd79439e07739166eaa3f7e41466c7ec8</id>
<content type='text'>
This patch cleans up and generalises part of the code which handles
overriding and calling a native base-class's __init__ method.  It defers
the call to the native make_new() function until after the user (Python)
__init__() method has run.  That user method now has the chance to call the
native __init__/make_new and pass it different arguments.  If the user
doesn't call the super().__init__ method then it will be called
automatically after the user code finishes, to finalise construction of the
instance.
</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>
<entry>
<title>py: Add config option to disable multiple inheritance.</title>
<updated>2017-11-20T05:18:50+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-04-01T12:52:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=da154fdaf933e6546ae4d6888af1a79a76d71b4c'/>
<id>urn:sha1:da154fdaf933e6546ae4d6888af1a79a76d71b4c</id>
<content type='text'>
This patch introduces a new compile-time config option to disable multiple
inheritance at the Python level: MICROPY_MULTIPLE_INHERITANCE.  It is
enabled by default.

Disabling multiple inheritance eliminates a lot of recursion in the call
graph (which is important for some embedded systems), and can be used to
reduce code size for ports that are really constrained (by around 200 bytes
for Thumb2 archs).

With multiple inheritance disabled all tests in the test-suite pass except
those that explicitly test for multiple inheritance.
</content>
</entry>
<entry>
<title>py/objtype: mp_obj_new_type: Name base types related vars more clearly.</title>
<updated>2017-11-10T22:11:24+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2017-11-10T22:11:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=cada971113e6db0cf9e0751e95dbe9217dd707b5'/>
<id>urn:sha1:cada971113e6db0cf9e0751e95dbe9217dd707b5</id>
<content type='text'>
As vars contains array of base types and its length, name them as such,
avoid generic "items" and "len" names.
</content>
</entry>
<entry>
<title>py/objtype: Introduce MICROPY_PY_ALL_INPLACE_SPECIAL_METHODS.</title>
<updated>2017-10-27T19:29:15+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2017-10-27T19:29:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=0e80f345f88c5db7c2353a5a9d29ed08b0af42f4'/>
<id>urn:sha1:0e80f345f88c5db7c2353a5a9d29ed08b0af42f4</id>
<content type='text'>
This allows to configure support for inplace special methods separately,
similar to "normal" and reverse special methods. This is useful, because
inplace methods are "the most optional" ones, for example, if inplace
methods aren't defined, the operation will be executed using normal
methods instead.

As a caveat, __iadd__ and __isub__ are implemented even if
MICROPY_PY_ALL_INPLACE_SPECIAL_METHODS isn't defined. This is similar
to the state of affairs before binary operations refactor, and allows
to run existing tests even if MICROPY_PY_ALL_INPLACE_SPECIAL_METHODS
isn't defined.
</content>
</entry>
<entry>
<title>py/objtype: Define all special methods if requested.</title>
<updated>2017-10-27T17:06:35+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2017-10-21T10:55:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=9b9dbc58155209e07ab7b9d63d63e5e24db5950c'/>
<id>urn:sha1:9b9dbc58155209e07ab7b9d63d63e5e24db5950c</id>
<content type='text'>
If MICROPY_PY_ALL_SPECIAL_METHODS is defined, actually define all special
methods (still subject to gating by e.g. MICROPY_PY_REVERSE_SPECIAL_METHODS).

This adds quite a number of qstr's, so should be used sparingly.
</content>
</entry>
<entry>
<title>py/objtype: Fit qstrs for special methods in byte type.</title>
<updated>2017-10-21T08:06:32+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2017-10-21T08:06:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=9956fd0710c3866b9df37857c9aa62b8bb681403'/>
<id>urn:sha1:9956fd0710c3866b9df37857c9aa62b8bb681403</id>
<content type='text'>
Update makeqstrdata.py to sort strings starting with "__" to the beginning
of qstr list, so they get low qstr id's, guaranteedly fitting in 8 bits.
Then use this property to further compact op_id =&gt; qstr mapping arrays.
</content>
</entry>
<entry>
<title>py/objtype: Use CPython compatible method name for sizeof.</title>
<updated>2017-10-19T09:44:53+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2017-10-19T09:40:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=f2baa9ec245a66c4cd7d990e39a4af3f6fab1cb7'/>
<id>urn:sha1:f2baa9ec245a66c4cd7d990e39a4af3f6fab1cb7</id>
<content type='text'>
Per https://docs.python.org/3/library/sys.html#sys.getsizeof:

getsizeof() calls the object’s __sizeof__ method. Previously, "getsizeof"
was used mostly to save on new qstr, as we don't really support calling
this method on arbitrary objects (so it was used only for reporting).
However, normalize it all now.
</content>
</entry>
</feed>
