Damien George
e10da77a5c
Merge branch 'master' of github.com:micropython/micropython
2014-04-14 23:44:20 +01:00
Damien George
3683789207
py: Clean up and add comments to makeqstrdata.
2014-04-14 23:38:37 +01:00
Paul Sokolovsky
a5854d2bc5
builtinimport: Add basic support for namespace packages.
...
That was easy - just avoid erroring out on seeing candidate dir for namespace
package. That's far from being complete though - namespace packages should
support importing portions of package from different sys.path entries, here
we require first matching entry to contain all namespace package's portions.
And yet, that's a way to put parts of the same Python package into multiple
installable package - something we really need for *Micro*Python.
2014-04-15 01:30:25 +03:00
Paul Sokolovsky
75ffcaeace
py: Implement __delitem__ method for classes.
2014-04-15 01:30:25 +03:00
Damien George
3d867f5eab
Merge pull request #479 from lurch/patch-1
...
Don't allow both ENDIANNESSes to be set
2014-04-14 21:41:05 +01:00
Damien George
3bb8bd899b
Make USE_COMPUTED_GOTO a config option in mpconfig.h.
...
Disabled by default. Enabled in unix port.
2014-04-14 21:20:30 +01:00
AZ Huang
b1f692e82e
Use computed goto instead of switching op-codes.
2014-04-15 02:40:28 +08:00
AZ Huang
658eae308f
Fix parallel build.
2014-04-15 01:47:14 +08:00
Andrew Scheller
cc83737d35
Don't allow both ENDIANNESSes to be set
...
See discussion on 2da81fa80c
Explicitly set `MP_ENDIANNESS_LITTLE` because that's the #define that is used in code elsewhere.
2014-04-14 02:39:56 +01:00
Paul Sokolovsky
bbae42d62f
modsys: Implement sys.version.
...
The logic appears to be that (at least beginning of) sys.versions is the
version of reference Python language implemented, not version of particular
implementation.
Also, bump set versions at 3.4.0, based on @dpgeorge preference.
2014-04-14 01:46:45 +03:00
Paul Sokolovsky
58676fc2c7
objstr: Allow to define statically allocated str objects.
...
Similar to tuples, lists, dicts. Statically allocated strings don't have hash
computed.
2014-04-14 01:45:06 +03:00
Paul Sokolovsky
59e269cfec
qstr, objstr: Make sure that valid hash != 0, treat 0 as "not computed".
...
This feature was proposed with initial hashing RFC, and is prerequisite for
seamless static str object definition.
2014-04-14 01:43:01 +03:00
Paul Sokolovsky
14de114ba8
objdict: Add __delitem__.
2014-04-13 23:55:59 +03:00
Paul Sokolovsky
cd94b384a3
objdict: Add __setitem__.
2014-04-13 23:41:49 +03:00
Damien George
777b0f32f4
py: Add property object, with basic functionality.
...
Enabled by MICROPY_ENABLE_PROPERTY.
2014-04-13 18:59:45 +01:00
Damien George
9dcc60d0b1
py: Detect ZeroDivisionError properly for floats.
2014-04-13 17:45:30 +01:00
Damien George
0e4ba25834
py: Fix SyntaxError exception: don't have a block name, so pass NULL.
2014-04-13 15:01:28 +01:00
Damien George
73496fbbe4
py: Fix up source-line calculation.
...
Should address issue #475 .
2014-04-13 14:51:56 +01:00
Damien George
d240ff83c7
Merge branch 'master' of github.com:micropython/micropython
2014-04-13 13:25:27 +01:00
Damien George
b502156e22
py: Adjust #includes in lexerunix.c.
2014-04-13 13:25:05 +01:00
Paul Sokolovsky
978d2c0267
modsys: Implement sys.byteorder.
2014-04-13 15:25:00 +03:00
Paul Sokolovsky
baaaf65eaa
modsys: Implement basic sys.version_info.
2014-04-13 15:25:00 +03:00
Damien George
da6c2fafb5
Merge pull request #470 from errordeveloper/misc_fix/lexerunix
...
py: don't look for any additional headers when lexerunix is disabled
2014-04-13 13:24:39 +01:00
Damien George
d395a0e4b1
Merge pull request #471 from errordeveloper/misc_fix/unistd
...
py: the entire `<unistd.h>` shouldn't be needed
2014-04-13 13:22:36 +01:00
Damien George
5bb7d99175
py: Modify makeqstrdata to recognise better the output of CPP.
2014-04-13 13:16:51 +01:00
Damien George
49f20b841d
py: Add more #if's for configurable MOD_SYS.
2014-04-13 13:05:16 +01:00
Damien George
640e7e4779
Merge pull request #476 from pfalcon/static-sys
...
Convert sys module to static allocation
2014-04-13 12:52:39 +01:00
Damien George
f95c68e536
Merge pull request #473 from pfalcon/list-extend-iter
...
objlist: Make .extend accept arbitrary iterable.
2014-04-13 12:46:34 +01:00
Damien George
b9e7ed4ebc
py: Oops, fix int.from_bytes to correctly convert bytes!
2014-04-13 12:40:50 +01:00
Damien George
5213eb35b5
py: Make int.from_bytes a classmethod; support arbitrary length buf.
2014-04-13 12:24:13 +01:00
Damien George
8a1cab952f
py: Fix mp_get_buffer, and use it in more places.
...
Must use mp_obj_get_type to get the type of an object. Can't assume
mp_obj_t is castable to mp_obj_base_t.
2014-04-13 12:08:52 +01:00
Damien George
4b01de44ba
py: Add traceback info to syntax errors.
...
Should fix issue #463 .
2014-04-13 11:56:02 +01:00
Damien George
3d484d9ad4
py: Update showbc to decode ptrs for MAKE_FUNCTION ops.
2014-04-13 11:22:44 +01:00
Damien George
df8127a17e
py: Remove unique_codes from emitglue.c. Replace with pointers.
...
Attempt to address issue #386 . unique_code_id's have been removed and
replaced with a pointer to the "raw code" information. This pointer is
stored in the actual byte code (aligned, so the GC can trace it), so
that raw code (ie byte code, native code and inline assembler) is kept
only for as long as it is needed. In memory it's now like a tree: the
outer module's byte code points directly to its children's raw code. So
when the outer code gets freed, if there are no remaining functions that
need the raw code, then the children's code gets freed as well.
This is pretty much like CPython does it, except that CPython stores
indexes in the byte code rather than machine pointers. These indices
index the per-function constant table in order to find the relevant
code.
2014-04-13 11:04:33 +01:00
Paul Sokolovsky
68e7c5146c
py: Factor out impl of special methods for builtin types into opmethods.c
2014-04-13 11:54:53 +03:00
Paul Sokolovsky
036ad76659
objset: Implement __contains__() op-method.
2014-04-13 11:34:40 +03:00
Paul Sokolovsky
1a37588e35
py: Provide more details for too few and too much args for Python fun calls.
2014-04-13 11:30:16 +03:00
Paul Sokolovsky
48fdaad824
py: Rename collections module to _collections.
...
We're not going to implement all the plethora of types in there in C.
Funnily, CPython implements defaultdict in C, and namedtuple in Python.
2014-04-13 10:24:00 +03:00
Paul Sokolovsky
4165cd1c0c
stmhal: Update for static mod sys.
2014-04-13 07:02:57 +03:00
Paul Sokolovsky
a3e50eacca
py: Move sys attribute qstrs's to core.
2014-04-13 07:02:57 +03:00
Paul Sokolovsky
5500cdeec7
py, unix: Convert sys module to static representation.
2014-04-13 07:02:56 +03:00
Paul Sokolovsky
18bef25a0c
objlist: Add support for statically allocated lists.
...
Similar to similar support for lists.
2014-04-13 07:02:56 +03:00
Paul Sokolovsky
f130ca1f60
py: Make bytes type hashable.
2014-04-13 06:45:12 +03:00
Paul Sokolovsky
73b7027b83
objstr: Add str.encode() and bytes.decode() methods.
...
These largely duplicate str() & bytes() constructors' functionality,
but can be used to achieve Python2 compatibility.
2014-04-13 06:45:02 +03:00
Paul Sokolovsky
aa6666c45e
objlist: Make .extend accept arbitrary iterable.
2014-04-13 03:21:31 +03:00
Damien George
8721087661
py: Big improvements to inline assembler.
...
Improved the Thumb assembler back end. Added many more Thumb
instructions to the inline assembler. Improved parsing of assembler
instructions and arguments. Assembler functions can now be passed the
address of any object that supports the buffer protocol (to get the
address of the buffer). Added an example of how to sum numbers from
an array in assembler.
2014-04-13 00:30:32 +01:00
Damien George
6ce4277551
py: Make all LOAD_FAST ops check for unbound local.
...
This is necessary to catch all cases where locals are referenced before
assignment. We still keep the _0, _1, _2 versions of LOAD_FAST to help
reduced the byte code size in RAM.
Addresses issue #457 .
2014-04-12 18:20:40 +01:00
Damien George
0a4c210586
Merge branch 'master' of github.com:micropython/micropython
2014-04-12 17:55:32 +01:00
Damien George
a26dc50968
py: Improve inline assembler; improve compiler constant folding.
2014-04-12 17:54:52 +01:00
Damien George
2813cb6043
py: Add 'static' to inline function MP_BOOL; remove category_t.
...
Small fixes to get it compiling with ARMCC. I have no idea why
category_t was in the enum definition for qstrs...
2014-04-12 17:53:05 +01:00