thewisenerd / python-on-a-chip

Automatically exported from code.google.com/p/python-on-a-chip
Other
0 stars 0 forks source link

Create bytearray datatype #89

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Lists and Tuple are wasteful for holding an array of bytes.  Strings can hold 
an array of bytes, but Strings aren't mutable and get cached.

CPython 2.6 introduced the bytearray type.  This type would be useful for 
holding packets of data.  However, the whole encode/decode interface may not 
be necessary.  Need to design which features of bytearray are 
needed/wanted/not-wanted.

Original issue reported on code.google.com by dwhall...@gmail.com on 25 May 2010 at 7:54

GoogleCodeExporter commented 9 years ago
Info & examples here: http://dabeaz.blogspot.com/2010/01/few-useful-bytearray-
tricks.html

Original comment by dwhall...@gmail.com on 30 May 2010 at 1:33

GoogleCodeExporter commented 9 years ago
Created HAVE_BYTEARRAY definition for src/platform/*/pmfeatures.h.  Added cases 
in *_SUBSCR bytecodes to handle code such as "bytearrayvar[subscr]".  Added 
code to print and compare bytearray objects.  Added cases to the garbage 
collector for bytearray and bytes structures.  The file bytearray.c has the 
fileid of 0x19.  Set C_TRUE to 1 so that bytearrayvar[True] modifies the second 
element (position [1]) of the array.  Added constructor "bytearray()" to 
builtins.  Updated docs/src/PyMiteFeatures.txt with information about the new 
datatype.

Original comment by dwhall...@gmail.com on 23 Jun 2010 at 10:15

GoogleCodeExporter commented 9 years ago
r503
System test t207 fails with these changes.  Investigation reveals that a GC 
error is to blame.  The error is most likely related to Issue #39.  Increasing 
the VM's heap to 0x4000 bytes allows all tests to pass.  For this reason, the 
code is being checked-in despite the failing test.  I expect Issue #39 to be 
resolved shortly.

Original comment by dwhall...@gmail.com on 23 Jun 2010 at 10:33

GoogleCodeExporter commented 9 years ago

Original comment by dwhall...@gmail.com on 23 Jun 2010 at 10:38

GoogleCodeExporter commented 9 years ago
r504
Previously forgot to add src/vm/bytearray.c and .h.  Added the files.

Original comment by dwhall...@gmail.com on 24 Jun 2010 at 1:22

GoogleCodeExporter commented 9 years ago
r516
Previously forgot to add src/tests/system/t289.*.  Added the files.

Original comment by dwhall...@gmail.com on 9 Jul 2010 at 8:24