Damien George
0b13f3e026
py: Improve memory usage debugging; better GC AT dumping.
In unix port, mem_info(1) now prints pretty GC alloc table.
10 years ago
Damien George
564963a170
py: Fix debug-printing of bytecode line numbers.
Also move the raw bytecode printing code from emitglue to mp_bytecode_print.
10 years ago
Damien George
d00d8ac95c
py: Use mp_uint_t where appropriate in stream functions.
10 years ago
Paul Sokolovsky
e2f8d98525
stream: Add optional 2nd "length" arg to .readinto() - extension to CPython.
While extension to file.readinto() definition of CPython, the additional arg
is similar to what in CPython available in socket.recv_into().
10 years ago
Damien George
e7bb0443cd
py: Properly free string parse-node; add assertion to gc_free.
10 years ago
Damien George
dd4f4530ab
py: Add builtin memoryview object (mostly using array code).
10 years ago
Damien George
3aa09f5784
py: Use MP_OBJ_NULL instead of NULL in a few places.
10 years ago
Damien George
37378f8a9d
py: Clean up edge cases of malloc/realloc/free.
10 years ago
Damien George
f5d69794a8
extmod: Add uheapq module.
10 years ago
Damien George
e72be1b999
py: Fix smallint modulo with negative arguments.
Addresses issue #927 .
10 years ago
Damien George
e7a478204a
py: Remove unused and unneeded SystemError exception.
It's purpose is for internal errors that are not catastrophic (ie not as
bad as RuntimeError). Since we don't use it, we don't need it.
10 years ago
Damien George
20f59e182e
py: Make mp_const_empty_bytes globally available.
10 years ago
stijn
2fe4cf7761
Implement kwargs for builtin open() and _io.FileIO
This makes open() and _io.FileIO() more CPython compliant.
The mode kwarg is fully iplemented.
The encoding kwarg is allowed but not implemented; mainly to allow
the tests to specify encoding for CPython, see #874
10 years ago
Damien George
21ca2d76a2
py: Partially fix viper multi-comparison; add test for it.
10 years ago
Paul Sokolovsky
1a55b6a787
unix, stmhal: Implement file.readinto() method.
Also, usocket.readinto(). Known issue is that .readinto() should be available
only for binary files, but micropython uses single method table for both
binary and text files.
10 years ago
Damien George
b7a4b0f86f
py: Improve stream_read so it doesn't need to alloc 2 bits of heap.
10 years ago
Damien George
391db8669b
py: Add more compiler optimisations for constant if/while conditions.
10 years ago
Damien George
235f9b33c8
py: Simplify compilation of elif blocks.
10 years ago
Damien George
c30595eb1b
py: Add more debug printing code in gc_dump_alloc_table.
10 years ago
Damien George
090c9236e8
py: Fix compiling of nested while/for and exception handler.
Addresses issue #912 .
10 years ago
Damien George
37ada236b3
py: Take gc_pool_start out of bss section, to reclaim 1st block of heap.
10 years ago
Paul Sokolovsky
923a8a8320
stream: Handle non-blocking errors in readline() properly.
Just like they handled in other read*(). Note that behavior of readline()
in case there's no data when it's called is underspecified in Python lib
spec, implemented to behave as read() - return None.
10 years ago
Paul Sokolovsky
0c7b26c0f8
stream: Return errno value as first arg of OSError exception.
This is CPython-compatible convention established yet in acb13886fc
.
10 years ago
Paul Sokolovsky
067ae1269d
objclosure: Fix printing of generator closures.
The code previously assumed that only functions can be closed over.
10 years ago
Damien George
9b0b373e5e
py: Fix GC realloc issue, where memory chunks were never shrunk.
Previously, a realloc to a smaller memory chunk size would not free the
unused blocks in the tail of the chunk.
10 years ago
Damien George
4859edb95b
py: Fix dummy definition of BEGIN/END_ATOMIC_SECTION.
10 years ago
Paul Sokolovsky
911c00bbc5
modzlibd: Remove, superceded by moduzlib.
10 years ago
Paul Sokolovsky
34162872b1
moduzlib: Integrate into the system.
10 years ago
Damien George
c14a81662c
py: Add module weak link support.
With this patch a port can enable module weak link support and provide
a dict of qstr->module mapping. This mapping is looked up only if an
import fails to find the requested module in the filesystem.
This allows to have the builtin module named, eg, usocket, and provide
a weak link of "socket" to the same module, but this weak link can be
overridden if a file by the name "socket.py" is found in the import
path.
10 years ago
Damien George
3c34d4140d
py: Fix x86 viper code generation, mem8 <-> mem16 for load.
10 years ago
Damien George
91cfd414c0
py: Implement native load for viper.
Viper can now do: ptr8(buf)[0], which loads a byte from a buffer using
machine instructions.
10 years ago
Damien George
1ef2348df0
py: Implement and,or,xor native ops for viper.
10 years ago
Paul Sokolovsky
1606607bd4
modure: Make sure that re1.5 compiled in only of modure itself is enabled.
This is achieved by including re1.5 *.c files straight from modure.c .
10 years ago
Paul Sokolovsky
c71e045165
modure: Initial module, using re1.5 (which is based on re1 codebase).
https://github.com/pfalcon/re1.5
10 years ago
Damien George
9bf5f2857d
py: Add further checks for failed malloc in lexer init functions.
10 years ago
Damien George
4091445612
py: Add #if guard around gc-specific code.
10 years ago
Dave Hylands
e20cbbec73
Make lexer fail gracefully when memory can't be allocated.
10 years ago
Dave Hylands
3556e45711
Allow real memory errors (from locked gc) to be reported with traceback.
10 years ago
Damien George
f32498fe04
py: Extra autodetect for little endianness using __LITTLE_ENDIAN__.
10 years ago
Damien George
9336ee320a
py: Make mp_binary_set_val work on big endian machine.
10 years ago
Damien George
fcdb239815
py: Make int.to_bytes work on big endian machine.
Partly addresses issue #856 .
10 years ago
Damien George
a9bcd51dc7
py: Try to autodetect machine endianness when not defined by port.
10 years ago
Damien George
c4d0868df1
py: Implement proper context save/restore for eval/exec; factor code.
This has benefits all round: code factoring for parse/compile/execute,
proper context save/restore for exec, allow to sepcify globals/locals
for eval, and reduced ROM usage by >100 bytes on stmhal and unix.
Also, the call to mp_parse_compile_execute is tail call optimised for
the import code, so it doesn't increase stack memory usage.
10 years ago
Damien George
a91ac2011f
py: Make compiler return a proper exception on SyntaxError.
10 years ago
Fabian Vogt
e5268963c6
Implement missing ARM emitter functions for viper
10 years ago
Damien George
00be7a849a
py: Fix unix-cpy to compile with uint->mp_uint_t changes.
10 years ago
Damien George
39dc145478
py: Change [u]int to mp_[u]int_t in qstr.[ch], and some other places.
This should pretty much resolve issue #50 .
10 years ago
Damien George
3eaa0c3833
py: Use UINT_FMT instead of %d.
10 years ago
Damien George
42f3de924b
py: Convert [u]int to mp_[u]int_t where appropriate.
Addressing issue #50 .
10 years ago
Damien George
8b03d944e2
py: Remove IOError since it's deprecated; use OSError instead.
In CPython IOError (and EnvironmentError) is deprecated and aliased to
OSError. All modules that used to raise IOError now raise OSError (or a
derived exception).
In Micro Python we never used IOError (except 1 place, incorrectly) and
so don't need to keep it.
See http://legacy.python.org/dev/peps/pep-3151/ for background.
10 years ago