<feed xmlns='http://www.w3.org/2005/Atom'>
<title>suspect-devices/circuitpython/tests/basics, branch 4.1.x</title>
<subtitle>CircuitPython - a Python implementation for teaching coding with microcontrollers</subtitle>
<id>https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=4.1.x</id>
<link rel='self' href='https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=4.1.x'/>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/'/>
<updated>2019-05-12T15:17:29+00:00</updated>
<entry>
<title>use approx of original @godlygeek code for smallints; add tests</title>
<updated>2019-05-12T15:17:29+00:00</updated>
<author>
<name>Dan Halbert</name>
<email>halbert@halwitz.org</email>
</author>
<published>2019-05-12T15:17:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=8664a6574b4cb448df26bfaa0e12eb203cc5d759'/>
<id>urn:sha1:8664a6574b4cb448df26bfaa0e12eb203cc5d759</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Add tests for overflows converting ints to bytes</title>
<updated>2019-05-09T07:22:24+00:00</updated>
<author>
<name>Matt Wozniski</name>
<email>godlygeek+git@gmail.com</email>
</author>
<published>2019-05-09T07:19:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=e041df73bb7bf424bcf571f25e3459359c4f36ed'/>
<id>urn:sha1:e041df73bb7bf424bcf571f25e3459359c4f36ed</id>
<content type='text'>
</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/lexer: Add support for underscores in numeric literals.</title>
<updated>2018-06-12T02:17:43+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-06-01T14:21:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=6a445b60fad87c94a1d00ce3a043b881a1f7a5a4'/>
<id>urn:sha1:6a445b60fad87c94a1d00ce3a043b881a1f7a5a4</id>
<content type='text'>
This is a very convenient feature introduced in Python 3.6 by PEP 515.
</content>
</entry>
<entry>
<title>py/objtype: Optimise instance get/set/del by skipping special accessors.</title>
<updated>2018-06-08T02:12:08+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-05-25T07:09:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=36c105218321167d47b0fb67575a7cddc36d17e7'/>
<id>urn:sha1:36c105218321167d47b0fb67575a7cddc36d17e7</id>
<content type='text'>
This patch is a code optimisation, trading text bytes for speed.  On
pyboard it's an increase of 0.06% in code size for a gain (in pystone
performance) of roughly 6.5%.

The patch optimises load/store/delete of attributes in user defined classes
by not looking up special accessors (@property, __get__, __delete__,
__set__, __setattr__ and __getattr_) if they are guaranteed not to exist in
the class.

Currently, if you do my_obj.foo() then the runtime has to do a few checks
to see if foo is a property or has __get__, and if so delegate the call.
And for stores things like my_obj.foo = 1 has to first check if foo is a
property or has __set__ defined on it.

Doing all those checks each and every time the attribute is accessed has a
performance penalty.  This patch eliminates all those checks for cases when
it's guaranteed that the checks will always fail, ie no attributes are
properties nor have any special accessor methods defined on them.

To make this guarantee it checks all attributes of a user-defined class
when it is first created.  If any of the attributes of the user class are
properties or have special accessors, or any of the base classes of the
user class have them, then it sets a flag in the class to indicate that
special accessors must be checked for.  Then in the load/store/delete code
it checks this flag to see if it can take the shortcut and optimise the
lookup.

It's an optimisation that's pretty widely applicable because it improves
lookup performance for all methods of user defined classes, and stores of
attributes, at least for those that don't have special accessors.  And, it
allows to enable descriptors with minimal additional runtime overhead if
they are not used for a particular user class.

There is one restriction on dynamic class creation that has been introduced
by this patch: a user-defined class cannot go from zero special accessors
to one special accessor (or more) after that class has been subclassed.  If
the script attempts this an AttributeError is raised (see addition to
tests/misc/non_compliant.py for an example of this case).

The cost in code space bytes for the optimisation in this patch is:

   unix x64:  +528
unix nanbox:  +508
      stm32:  +192
     cc3200:  +200
    esp8266:  +332
      esp32:  +244

Performance tests that were done:

- on unix x86-64, pystone improved by about 5%
- on pyboard, pystone improved by about 6.5%, from 1683 up to 1794
- on pyboard, bm_chaos (from CPython benchmark suite) improved by about 5%
- on esp32, pystone improved by about 30% (but there are caching effects)
- on esp32, bm_chaos improved by about 11%
</content>
</entry>
<entry>
<title>py/objtype: Fix assertion failures in super_attr by checking type.</title>
<updated>2018-05-30T01:14:07+00:00</updated>
<author>
<name>Jeff Epler</name>
<email>jepler@unpythonic.net</email>
</author>
<published>2018-03-25T21:13:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=c60589c02b998794837489a6c6e51c4723af097f'/>
<id>urn:sha1:c60589c02b998794837489a6c6e51c4723af097f</id>
<content type='text'>
Fixes assertion failures and segmentation faults when making calls like:

    super(1, 1).x
</content>
</entry>
<entry>
<title>py/objtype: Fix assertion failures in mp_obj_new_type by checking types.</title>
<updated>2018-05-30T01:11:24+00:00</updated>
<author>
<name>Jeff Epler</name>
<email>jepler@unpythonic.net</email>
</author>
<published>2018-03-25T21:05:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=05b13fd292b42f20affc7cae218d92447efbf6d6'/>
<id>urn:sha1:05b13fd292b42f20affc7cae218d92447efbf6d6</id>
<content type='text'>
Fixes assertion failures when the arguments to type() were not of valid
types, e.g., when making calls like:

    type("", (), 3)
    type("", 3, {})
</content>
</entry>
<entry>
<title>py/objtype: Remove TODO comment about needing to check for property.</title>
<updated>2018-05-25T00:59:40+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-05-25T00:59:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=dfeaea144168c3ec3b4ec513cfb201ce93f99f5e'/>
<id>urn:sha1:dfeaea144168c3ec3b4ec513cfb201ce93f99f5e</id>
<content type='text'>
Instance members are always treated as values, even if they are properties.
A test is added to show this is the case.
</content>
</entry>
<entry>
<title>py/objgenerator: Protect against reentering a generator.</title>
<updated>2018-05-22T06:54:03+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-05-22T06:54:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=400273a799581e5eb86538d8c88fb872705475ab'/>
<id>urn:sha1:400273a799581e5eb86538d8c88fb872705475ab</id>
<content type='text'>
Generators that are already executing cannot be reexecuted.  This patch
puts in a check for such a case.

Thanks to @jepler for finding the bug.
</content>
</entry>
<entry>
<title>py/modbuiltins: Add support for rounding integers.</title>
<updated>2018-05-22T04:18:16+00:00</updated>
<author>
<name>Jan Klusacek</name>
<email>honza.klu@gmail.com</email>
</author>
<published>2018-01-09T21:47:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=b318ebf1015ced6354f8bbaf035308214b3f5c5d'/>
<id>urn:sha1:b318ebf1015ced6354f8bbaf035308214b3f5c5d</id>
<content type='text'>
As per CPython semantics.  This feature is controlled by
MICROPY_PY_BUILTINS_ROUND_INT which is disabled by default.
</content>
</entry>
</feed>
