summaryrefslogtreecommitdiff
path: root/py/objexcept.c
AgeCommit message (Collapse)Author
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.
2014-03-20Added ZeroDivisionError to float division.Rachel Dowdall
2014-03-17py: Clean up includes.xbe
Remove unnecessary includes. Add includes that improve portability.
2014-03-09py: Fix printing of type name.Damien George
2014-02-15py: VM never throws an exception, instead returns a status and value.Damien George
Addresses issue #290, and hopefully sets up things to allow generators throwing exceptions, etc.
2014-02-15py: Improve exception bases, reduces ROM usage.Damien George
Thanks to @pfalcon for the tip!
2014-02-15Implement proper exception type hierarchy.Damien George
Each built-in exception is now a type, with base type BaseException. C exceptions are created by passing a pointer to the exception type to make an instance of. When raising an exception from the VM, an instance is created automatically if an exception type is raised (as opposed to an exception instance). Exception matching (RT_BINARY_OP_EXCEPTION_MATCH) is now proper. Handling of parse error changed to match new exceptions. mp_const_type renamed to mp_type_type for consistency.
2014-02-15Change mp_obj_type_t.name from const char * to qstr.Damien George
Ultimately all static strings should be qstr. This entry in the type structure is only used for printing error messages (to tell the type of the bad argument), and printing objects that don't supply a .print method.
2014-02-15objexcept: Fix a case of initialized object field.Paul Sokolovsky
2014-02-12Remove mp_obj_new_exception_msg_1_arg and _2_arg.Damien George
2014-02-12Replace global "static" -> "STATIC", to allow "analysis builds". Part 1.Paul Sokolovsky
Some tools do not support local/static symbols (one example is GNU ld map file). Exposing all functions will allow to do detailed size comparisons, etc. Also, added bunch of statics where they were missing, and replaced few identity functions with global mp_identity().
2014-01-31Typo fixes in comments.Paul Sokolovsky
2014-01-29py: Msg in exception is no longer interned.Damien George
2014-01-21Revamp qstrs: they now include length and hash.Damien George
Can now have null bytes in strings. Can define ROM qstrs per port using qstrdefsport.h
2014-01-19py: Add full traceback to exception printing.Damien George
2014-01-19py: Add module/function/class name to exceptions.Damien George
Exceptions know source file, line and block name. Also tidy up some debug printing functions and provide a global flag to enable/disable them.
2014-01-18Add source file name and line number to error messages.Damien George
Byte code has a map from byte-code offset to source-code line number, used to give better error messages.
2014-01-18Make VM stack grow upwards, and so no reversed args arrays.Damien George
Change state layout in VM so the stack starts at state[0] and grows upwards. Locals are at the top end of the state and number downwards. This cleans up a lot of the interface connecting the VM to C: now all functions that take an array of Micro Python objects are in order (ie no longer in reverse). Also clean up C API with keyword arguments (call_n and call_n_kw replaced with single call method that takes keyword arguments). And now make_new takes keyword arguments. emitnative.c has not yet been changed to comply with the new order of stack layout.
2014-01-15type->print(): Distinguish str() and repr() variety by passing extra param.Paul Sokolovsky
2014-01-15Refactor exception objects to have better impl of Python-side interface.Paul Sokolovsky
This implements internal args tuple of arguments, while still keeping object useful for reporting C-side errors. Further elaboration is needed.
2014-01-08py: add variable argument exception constructor function.Damien George
Addresses issue #104.
2014-01-07Merge branch 'cplusplus' of https://github.com/ian-v/micropython into ↵Damien George
ian-v-cplusplus Conflicts: py/objcomplex.c
2014-01-06Co-exist with C++ (issue #85)ian-v
2014-01-05Convert many object types structs to use C99 tagged initializer syntax.Paul Sokolovsky
2014-01-04Convert Python types to proper Python type hierarchy.Damien George
Now much more inline with how CPython does types.
2013-12-29py: implement some basic exception matching.Damien
2013-12-21Change object representation from 1 big union to individual structs.Damien
A big change. Micro Python objects are allocated as individual structs with the first element being a pointer to the type information (which is itself an object). This scheme follows CPython. Much more flexible, not necessarily slower, uses same heap memory, and can allocate objects statically. Also change name prefix, from py_ to mp_ (mp for Micro Python).