Damien George
93e51b594a
stmhal: Enable cmath module.
2014-05-03 18:40:50 +01:00
Damien George
9c5fc83e6a
py, objtype.c: Rename class_ to instance_ following change of typedef.
...
This follows up 0a7e01ae3c
.
2014-05-03 17:19:35 +01:00
Damien George
c12242e9df
Merge pull request #546 from stinos/relax-makeqstrdata
...
More relaxed parsing of preprocessed qstr header
2014-05-03 13:27:04 +01:00
Paul Sokolovsky
7a14022604
Merge pull request #552 from stinos/mingw-alloca
...
py: Use <alloca.h> for alloca()
2014-05-03 14:39:47 +03:00
Paul Sokolovsky
418aca976c
objclosure, objcell: Print detailed representation if was requested.
...
Well, it is bound to "detailed error reporting", but that's closest what we
have now without creating new entities.
2014-05-03 14:16:11 +03:00
stijn
1dc7f0427b
More relaxed parsing of preprocessed qstr header
...
The original parsing would error out on any C declarations that are not typedefs
or extern variables. This limits what can go in mpconfig.h and mpconfigport.h,
as they are included in qstr.h. For instance even a function declaration would be
rejected and including system headers is a complete no-go.
That seems too limiting for a global config header, so makeqstrdata now
ignores everything that does not match a qstr definition.
2014-05-03 10:26:31 +02:00
stijn
98e2ee0ec1
py: Use <alloca.h> for alloca()
...
alloca() is declared in alloca.h which als happens to be included by stdlib.h.
On mingw however it resides in malloc.h only.
So if we include alloca.h directly, and add an alloca.h for mingw in it's port
directory we can get rid of the mingw-specific define to include malloc.h
and the other ports are happy as well.
2014-05-03 10:14:53 +02:00
Paul Sokolovsky
f54bcbf099
py, unix: Make "mpconfig.h" be first included, as other headers depend on it.
...
Specifically, nlr.h does.
2014-05-02 17:48:40 +03:00
Paul Sokolovsky
e0954d426f
objtype: Work around stupid strict aliasing check.
2014-05-02 17:48:40 +03:00
Paul Sokolovsky
91e556af23
objexcept: Support tracebacks for user Exception subclasses.
2014-05-02 02:31:30 +03:00
Paul Sokolovsky
0a7e01ae3c
objtype: Rename mp_obj_class_t -> mp_obj_instance_t and move to local header.
...
TODO: Rename methods.
2014-05-02 02:14:38 +03:00
Paul Sokolovsky
d8351ca8a0
objtype: .print() Exception instances in adhoc way.
...
This is ugly, just as expected.
2014-05-02 02:00:47 +03:00
Paul Sokolovsky
28dfbc2ba2
Merge pull request #544 from lurch/fix-minmax
...
Fix the builtin min() and max() functions (and add tests).
2014-05-01 23:42:18 +03:00
Paul Sokolovsky
7917b731f6
objfun: More debug logging.
2014-05-01 23:22:11 +03:00
Paul Sokolovsky
5ba58f4a1a
objgenerator: Fix check for too few args passed to gen function.
2014-05-01 23:22:11 +03:00
Paul Sokolovsky
c3103b55c1
objgenerator: .print(): Output real underlying function name.
2014-05-01 23:22:11 +03:00
Andrew Scheller
37067666ee
Fix the builtin min() and max() functions (and add tests).
...
Fixes #539
2014-05-01 21:21:43 +01:00
Paul Sokolovsky
1f85d6255d
py: Add tentative scheme for error messages configuration.
2014-05-01 01:50:35 +03:00
Paul Sokolovsky
68551a8428
objfun: Add function name accessor and .print slot method.
2014-05-01 01:50:35 +03:00
Damien George
37977b7b27
Merge pull request #528 from pfalcon/native-subclass1
...
Initial support for subclassing native types
2014-04-30 21:02:50 +01:00
Paul Sokolovsky
22d0598818
objfun: Factor out function to report positional args mismatch.
2014-04-30 05:37:28 +03:00
Paul Sokolovsky
e908591baa
py: Abstract no-return attribute for functions a bit.
2014-04-30 05:35:18 +03:00
Paul Sokolovsky
b1ce37d32e
py: If setjmp NLR implementation is forced, omit native versions.
2014-04-30 04:19:20 +03:00
Paul Sokolovsky
851c856585
nlr.h: As we treat all warnings as errors, can't use #warning.
...
And this is not good.
2014-04-30 04:14:31 +03:00
Paul Sokolovsky
7f0419c0e5
objtype: Support calling normal methods inherited from native base class.
...
Biggest part of this support is refactoring mp_obj_class_lookup() to return
standard "bound member" pair (mp_obj_t[2]). Actual support of inherited
native methods is 3 lines then. Some inherited features may be not supported
yet (e.g. native class methods, native properties, etc., etc.). There may
be opportunities for further optimization too.
2014-04-30 02:14:30 +03:00
Paul Sokolovsky
443857de98
objtype: Add support for looking up non-method attrs in native base class.
2014-04-29 20:31:13 +03:00
Paul Sokolovsky
6ead0d2fbc
objtype: Implement basic framework for subclassing native types.
...
This implements checking of base types, allocation and basic initialization,
and optimized support for special method lookups. Other features are not yet
supported.
2014-04-29 20:31:13 +03:00
Damien George
186e463a9e
py: Fix bug in map lookup of interned string vs non-interned.
...
Had choice of either interning or forcing full equality comparison, and
chose latter. See comments in mp_map_lookup.
Addresses issue #523 .
2014-04-28 12:11:57 +01:00
Damien George
185f9c1c46
py: Fix lexerunix, where not all data may be read from a file.
...
Addresses issue #526 .
2014-04-28 11:43:28 +01:00
Damien George
0c8fcb9c49
py: Remove silly comment about interning keywords.
...
Of course, keywords are turned into lexer tokens in the lexer, so will
never need to be interned (unless you do something like x="def").
As it is now, the following on pyboard makes no new qstrs:
import pyb
pyb.info()
2014-04-28 09:56:31 +01:00
Paul Sokolovsky
a224067846
py: Clear allocated, but unused memory in containers.
...
Also, clear up freed slots in containers.
As a follow up to 32bef315be
.
2014-04-28 00:33:21 +03:00
Paul Sokolovsky
7ce6a8fe46
objlist: We no longer need to assert on mem alloc results.
...
They either succeed or raise exception.
2014-04-28 00:33:21 +03:00
Paul Sokolovsky
48bf6b3bd0
objlist: Use static small int constructor.
2014-04-28 00:33:21 +03:00
Damien George
708c073250
py: Add '*' qstr for 'import *'; use blank qstr for comprehension arg.
2014-04-27 19:23:46 +01:00
Damien George
968bf34c4c
py: Remove unnecessary LOAD_CONST_ID bytecode.
...
It's the same as LOAD_CONST_STR.
2014-04-27 19:12:05 +01:00
Damien George
db12891918
py: Eliminate 'op' variable in VM dispatch loop.
...
Remembering the last op is rarely needed, and when it is, can simply use
*save_ip.
2014-04-27 18:19:06 +01:00
Damien George
9d181f62dc
py: Save some ROM by shortening compiler error messages.
...
Messages are still explanatory, while taking a little less ROM.
2014-04-27 16:55:27 +01:00
Damien George
2c0842b3c5
py: Change the way function arguments are compiled.
...
New way uses slightly less ROM and RAM, should be slightly faster, and,
most importantly, allows to catch the error "non-keyword arg following
keyword arg".
Addresses issue #466 .
2014-04-27 16:46:51 +01:00
Damien George
2827d62e8b
py: Implement keyword-only args.
...
Implements 'def f(*, a)' and 'def f(*a, b)', but not default
keyword-only args, eg 'def f(*, a=1)'.
Partially addresses issue #524 .
2014-04-27 15:50:52 +01:00
Damien George
36cbd0db7e
Merge branch 'master' of github.com:micropython/micropython
2014-04-26 22:24:45 +01:00
Damien George
32bef315be
py, gc: Only zero out the extra bytes at the end of the heap chunk.
...
This is a small optimisation to zero out only the additional bytes that
the caller did not ask for.
2014-04-26 22:23:42 +01:00
Paul Sokolovsky
27f5bdd6d4
py: "read" & "write" are so common that make them core.
...
Few other strings move to core, but make depend on "io" module.
2014-04-26 21:15:56 +03:00
Paul Sokolovsky
100cd36a0e
objstringio: Compile only if MICROPY_ENABLE_MOD_IO defined.
2014-04-26 20:59:39 +03:00
Paul Sokolovsky
cb9dc086a3
modio: Implement io.StringIO class.
2014-04-26 20:26:14 +03:00
Damien George
dbc81df5d4
Simplify names for argcheck.c / arg parsing.
2014-04-26 11:19:17 +01:00
Damien George
6d3c5e4301
Add ARRAY_SIZE macro, and use it where possible.
2014-04-26 10:47:29 +01:00
Damien George
d139c489ba
Merge branch 'master' of github.com:micropython/micropython
2014-04-26 10:31:58 +01:00
Damien George
107c9fb235
py: Make collections module configurable, enabled by default.
2014-04-26 10:31:15 +01:00
Paul Sokolovsky
e14d096cb7
objstr: Optimize .rstrip() by scanning string from end.
2014-04-26 06:48:31 +03:00
Paul Sokolovsky
881078403e
objstr: Implement .lstrip() & .rstrip().
...
Share code with .strip(). TODO: optimize .rstrip().
2014-04-26 06:20:08 +03:00