<feed xmlns='http://www.w3.org/2005/Atom'>
<title>suspect-devices/circuitpython/py/obj.c, branch v1.4.4</title>
<subtitle>CircuitPython - a Python implementation for teaching coding with microcontrollers</subtitle>
<id>https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=v1.4.4</id>
<link rel='self' href='https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=v1.4.4'/>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/'/>
<updated>2015-05-12T22:05:53+00:00</updated>
<entry>
<title>py: Add mp_obj_get_int_truncated and use it where appropriate.</title>
<updated>2015-05-12T22:05:53+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-05-12T22:05:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=c50772d19fe2804a6d0258f89dd9967d3b516fd3'/>
<id>urn:sha1:c50772d19fe2804a6d0258f89dd9967d3b516fd3</id>
<content type='text'>
mp_obj_get_int_truncated will raise a TypeError if the argument is not
an integral type.  Use mp_obj_int_get_truncated only when you know the
argument is a small or big int.
</content>
</entry>
<entry>
<title>py: Convert hash API to use MP_UNARY_OP_HASH instead of ad-hoc function.</title>
<updated>2015-05-12T21:46:02+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-05-11T12:25:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=c2a4e4effc81d8ab21bb014e34355643e5ca0da2'/>
<id>urn:sha1:c2a4e4effc81d8ab21bb014e34355643e5ca0da2</id>
<content type='text'>
Hashing is now done using mp_unary_op function with MP_UNARY_OP_HASH as
the operator argument.  Hashing for int, str and bytes still go via
fast-path in mp_unary_op since they are the most common objects which
need to be hashed.

This lead to quite a bit of code cleanup, and should be more efficient
if anything.  It saves 176 bytes code space on Thumb2, and 360 bytes on
x86.

The only loss is that the error message "unhashable type" is now the
more generic "unsupported type for __hash__".
</content>
</entry>
<entry>
<title>obj: Handle user instance hash based on Python adhoc rules.</title>
<updated>2015-05-05T19:48:19+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2015-05-04T19:41:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=37c6555b4419eb6027a345ee0c3e759d50da771f'/>
<id>urn:sha1:37c6555b4419eb6027a345ee0c3e759d50da771f</id>
<content type='text'>
User instances are hashable by default (using __hash__ inherited from
"object"). But if __eq__ is defined and __hash__ not defined in particular
class, instance is not hashable.
</content>
</entry>
<entry>
<title>objsingleton: New home for Ellipsis and NotImplemented.</title>
<updated>2015-05-05T19:18:07+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2015-05-05T19:18:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=76677270218fb5732296e4fe1a0acbe05c8f818c'/>
<id>urn:sha1:76677270218fb5732296e4fe1a0acbe05c8f818c</id>
<content type='text'>
Having NotImplemented as MP_OBJ_SENTINEL turned out to be problematic
(it needs to be checked for in a lot of places, otherwise it'll crash
as would pass MP_OBJ_IS_OBJ()), so made a proper singleton value like
Ellipsis, both of them sharing the same type.
</content>
</entry>
<entry>
<title>modbuiltins: Add NotImplemented builtin constant.</title>
<updated>2015-05-04T16:45:53+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2015-05-04T16:45:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=5ab5ac5448573fa34cc2316d895706c24a412f36'/>
<id>urn:sha1:5ab5ac5448573fa34cc2316d895706c24a412f36</id>
<content type='text'>
From https://docs.python.org/3/library/constants.html#NotImplemented :
"Special value which should be returned by the binary special methods
(e.g. __eq__(), __lt__(), __add__(), __rsub__(), etc.) to indicate
that the operation is not implemented with respect to the other type;
may be returned by the in-place binary special methods (e.g. __imul__(),
__iand__(), etc.) for the same purpose. Its truth value is true."

Some people however appear to abuse it to mean "no value" when None is
a legitimate value (don't do that).
</content>
</entry>
<entry>
<title>py: Add %q format support to mp_[v]printf, and use it.</title>
<updated>2015-04-16T14:30:16+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-04-11T12:03:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=044c473de203b4dbe93874813b430fb6336db2b2'/>
<id>urn:sha1:044c473de203b4dbe93874813b430fb6336db2b2</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py: Make mp_sys_stdout_print object, wrapping sys.stdout for mp_print*.</title>
<updated>2015-04-16T14:30:16+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-04-11T11:01:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=5ae5ec986ea5e14321f6c8091454c165c23b40c5'/>
<id>urn:sha1:5ae5ec986ea5e14321f6c8091454c165c23b40c5</id>
<content type='text'>
So now all printing should go via either mp_plat_print or
mp_sys_stdout_print.
</content>
</entry>
<entry>
<title>py: Overhaul and simplify printf/pfenv mechanism.</title>
<updated>2015-04-16T14:30:16+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2015-04-09T22:56:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=7f9d1d6ab923096582622b700bedb6a571518eac'/>
<id>urn:sha1:7f9d1d6ab923096582622b700bedb6a571518eac</id>
<content type='text'>
Previous to this patch the printing mechanism was a bit of a tangled
mess.  This patch attempts to consolidate printing into one interface.

All (non-debug) printing now uses the mp_print* family of functions,
mainly mp_printf.  All these functions take an mp_print_t structure as
their first argument, and this structure defines the printing backend
through the "print_strn" function of said structure.

Printing from the uPy core can reach the platform-defined print code via
two paths: either through mp_sys_stdout_obj (defined pert port) in
conjunction with mp_stream_write; or through the mp_plat_print structure
which uses the MP_PLAT_PRINT_STRN macro to define how string are printed
on the platform.  The former is only used when MICROPY_PY_IO is defined.

With this new scheme printing is generally more efficient (less layers
to go through, less arguments to pass), and, given an mp_print_t*
structure, one can call mp_print_str for efficiency instead of
mp_printf("%s", ...).  Code size is also reduced by around 200 bytes on
Thumb2 archs.
</content>
</entry>
<entry>
<title>py: Use a dummy type for referring to extern structs</title>
<updated>2015-04-09T13:03:22+00:00</updated>
<author>
<name>stijn</name>
<email>stinos@zoho.com</email>
</author>
<published>2015-04-09T10:27:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=e50cff69bb0dbca8ed363b5c7c459e01cb7f00ac'/>
<id>urn:sha1:e50cff69bb0dbca8ed363b5c7c459e01cb7f00ac</id>
<content type='text'>
Fixes msvc linker warnings about mismatching sizes between the mp_obj_fdfile_t
struct defined in file.c and the mp_uint_t declarations found in modsys.c and modbuiltins.c
</content>
</entry>
<entry>
<title>py: Fix mp_obj_print() to work when Python streams are not used.</title>
<updated>2015-02-16T22:32:18+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2015-02-16T22:32:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=8c705233f3bb335a5531cc397b794a7537b9daf7'/>
<id>urn:sha1:8c705233f3bb335a5531cc397b794a7537b9daf7</id>
<content type='text'>
</content>
</entry>
</feed>
