summaryrefslogtreecommitdiff
path: root/py/objexcept.c
AgeCommit message (Collapse)Author
2015-01-20py: Use mp_arg_check_num in some _make_new functions.Damien George
Reduces stmhal code size by about 250 bytes.
2015-01-07py: Put all global state together in state structures.Damien George
This patch consolidates all global variables in py/ core into one place, in a global structure. Root pointers are all located together to make GC tracing easier and more efficient.
2015-01-01py: Move to guarded includes, everywhere in py/ core.Damien George
Addresses issue #1022.
2014-10-31py: Make gc.enable/disable just control auto-GC; alloc is still allowed.Damien George
gc.enable/disable are now the same as CPython: they just control whether automatic garbage collection is enabled or not. If disabled, you can still allocate heap memory, and initiate a manual collection.
2014-10-25py: Add mp_pending_exception global variable, for VM soft interrupt.Damien George
This allows to implement KeyboardInterrupt on unix, and a much safer ctrl-C in stmhal port. First ctrl-C is a soft one, with hope that VM will notice it; second ctrl-C is a hard one that kills anything (for both unix and stmhal). One needs to check for a pending exception in the VM only for jump opcodes. Others can't produce an infinite loop (infinite recursion is caught by stack check).
2014-10-22py: Remove unused and unneeded SystemError exception.Damien George
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.
2014-10-15py: Fix dummy definition of BEGIN/END_ATOMIC_SECTION.Damien George
2014-09-30py: Remove IOError since it's deprecated; use OSError instead.Damien George
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.
2014-09-25py: Tidy up exception matching; allow matching of tuple of exceptions.Damien George
Addresses issue #864.
2014-08-30py: Change all uint to mp_uint_t in obj.h.Damien George
Part of code cleanup, working towards resolving issue #50.
2014-08-30py: Make tuple and list use mp_int_t/mp_uint_t.Damien George
Part of code cleanup, to resolve issue #50.
2014-08-30Change some parts of the core API to use mp_uint_t instead of uint/int.Damien George
Addressing issue #50, still some way to go yet.
2014-08-25stmhal: Make enable_irq and disable_irq inline functions.Damien George
These functions are generally 1 machine instruction, and are used in critical code, so makes sense to have them inline. Also leave these functions uninverted (ie 0 means enable, 1 means disable) and provide macro constants if you really need to distinguish the states. This makes for smaller code as well (combined with inlining). Applied to teensy port as well.
2014-08-25Add save/restore_irqDave Hylands
Factored irq functions into a separate file.
2014-07-25Add support for storing args during an exception raised by an irq.Dave Hylands
The user code should call micropython.alloc_emergency_exception_buf(size) where size is the size of the buffer used to print the argument passed to the exception. With the test code from #732, and a call to micropython.alloc_emergenncy_exception_buf(100) the following error is now printed: ```python >>> import heartbeat_irq Uncaught exception in Timer(4) interrupt handler Traceback (most recent call last): File "0://heartbeat_irq.py", line 14, in heartbeat_cb NameError: name 'led' is not defined ```
2014-07-03Rename machine_(u)int_t to mp_(u)int_t.Damien George
See discussion in issue #50.
2014-07-01py, objexcept: Only check for locked gc if gc is enabled.Damien George
2014-06-30Try not to cause a MemoryError when raising an exception during nterrupt ↵Dave Hylands
handling. Step 1 fixes #732
2014-06-06Change comments (mainly URLs) to no longer specifically say Python 3.3Chris Angelico
2014-05-25Change const byte* to const char* where sensible.Damien George
This removes need for some casts (at least, more than it adds need for new casts!).
2014-05-24Add SystemExit exception and use it in unix/ and stmhal/ ports.Damien George
Addresses issue #598.
2014-05-21Merge pull request #607 from Anton-2/osx-clangDamien George
Allow compilation of unix port under clang on OS X
2014-05-19objexcept: Implement explicit __init__ method, useful for subclasses.Paul Sokolovsky
2014-05-12Fix some unused variables, and silence a clang warning about initialization ↵Antonin ENFRUN
override in vmentrytable.h
2014-05-11py: Rename globally-accessible tuple functions, prefix with mp_obj_.Damien George
Likely there are other functions that should be renamed, but this is a start.
2014-05-03Add license header to (almost) all files.Damien George
Blanket wide to all .c and .h files. Some files originating from ST are difficult to deal with (license wise) so it was left out of those. Also merged modpyb.h, modos.h, modstm.h and modtime.h in stmhal/.
2014-05-02py, unix: Make "mpconfig.h" be first included, as other headers depend on it.Paul Sokolovsky
Specifically, nlr.h does.
2014-05-02objexcept: Support tracebacks for user Exception subclasses.Paul Sokolovsky
2014-05-02objtype: .print() Exception instances in adhoc way.Paul Sokolovsky
This is ugly, just as expected.
2014-04-23objexcept: Don't store args tuple within exception object.Paul Sokolovsky
To avoid pointer-to-field GC problem.
2014-04-22objexcept: Add mp_obj_new_exception_arg1() convenience function.Paul Sokolovsky
2014-04-10py: Check explicitly for memory allocation failure in parser.Damien George
Previously, a failed malloc/realloc would throw an exception, which was not caught. I think it's better to keep the parser free from NLR (exception throwing), hence this patch.
2014-04-10py: Add emergency exception object for when heap allocation fails.Damien George
2014-04-05py: Change nlr_jump to nlr_raise, to aid in debugging.Damien George
This does not affect code size or performance when debugging turned off. To address issue #420.
2014-04-04py: Add m_malloc_fail function to handle memory allocation error.Damien George
A malloc/realloc fail now throws MemoryError.
2014-03-31objexcept: No more magic messages in exceptions, only exception arguments.Paul Sokolovsky
One of the reason for separate "message" (besides still unfulfilled desire to optimize memory usage) was apparent special handling of exception with messages by CPython. Well, the message is still just an exception argument, it just printed specially. Implement that with PRINT_EXC printing format.
2014-03-30Rename rt_* to mp_*.Damien George
Mostly just a global search and replace. Except rt_is_true which becomes mp_obj_is_true. Still would like to tidy up some of the names, but this will do for now.
2014-03-30objexcept: Fix another place missing proper args tuple initialization.Paul Sokolovsky
2014-03-29py: Change mp_const_* objects to macros.Damien George
Addresses issue #388.
2014-03-28objgenerator: close(): Throw instance of GeneratorExit (not type).Paul Sokolovsky
To comply with Python semantics and allow use of mp_obj_is_subclass_fast() for exception matching.
2014-03-27py: Thin out predefined exceptions.Damien George
Only exceptions that are actually used are left prefedined. Hierarchy is still there, and removed exceptions are just commented out.
2014-03-26Merge branch 'master' of github.com:micropython/micropythonDamien George
2014-03-26Merge branch 'gen-close-ret-val' of github.com:pfalcon/micropython into ↵Damien George
pfalcon-gen-close-ret-val
2014-03-26py: Add support for user-defined iterators via __iter__, __next__.Damien George
2014-03-26objexcept: Add mp_obj_exception_get_value() convenience function.Paul Sokolovsky
This gets "value" of exceptions in the sense as it's defined for StopIteration.value (i.e. args[0] or None). TODO: This really should be inline function.
2014-03-26objgenerator: Implement return with value and .close() method.Paul Sokolovsky
Return with value gets converted to StopIteration(value). Implementation keeps optimizing against creating of possibly unneeded exception objects, so there're considerable refactoring to implement these features.
2014-03-25py: Removed some unnecessary exception objects.Damien George
They still exist in commented-out form in objexcept.c if they are ever needed.
2014-03-25objexcept: Add "args" exception attribute, as well as StopIteration.value.Paul Sokolovsky
2014-03-22py: Remove some unnecessary exception objects.Damien George
2014-03-22Added exception hierarchy except for OSError and UnicodeError (requires ↵Rachel Dowdall
arguments). Comment out the errors that aren't needed if memory becomes an issue.