Commit Graph

19 Commits

Author SHA1 Message Date
Dan Halbert 10d3a20f8a Add CIRCUITPY macro; rename u* only when CIRCUITPY=1 2019-02-21 11:09:44 -05:00
Dan Halbert c5dbdbe88c rename ure, ujson, and uerrno to re, json, and errno 2019-02-21 00:33:36 -05:00
Craig Forbes 1662e02c1b Add human readable text for ENOSPC. 2019-02-06 14:59:01 -06:00
Noralf Trønnes c5aa2e9300 Support OSError attributes
This adds support for the OSError attributes : errno, strerror, filename and filename2.
CPython only sets errno if 2 arguments has been passed in. This has not been implemented here.

CPython OSError.args is capped at 2 items for backward compatibility reasons. This has not been
implemented here.

MICROPY_CPYTHON_COMPAT has to be enabled to get these attributes.

mp_common_errno_to_str() has been extended to check mp_errno_to_str() as well. This is done to ease
reuse for the strerror argument.
2018-11-13 22:04:44 +01:00
Scott Shawcroft de5a9d72dc
Compress all translated strings with Huffman coding.
This saves code space in builds which use link-time optimization.
The optimization drops the untranslated strings and replaces them
with a compressed_string_t struct. It can then be decompressed to
a c string.

Builds without LTO work as well but include both untranslated
strings and compressed strings.

This work could be expanded to include QSTRs and loaded strings if
a compress method is added to C. Its tracked in #531.
2018-08-16 17:40:57 -07:00
Scott Shawcroft 96ebf5bc3f
Two fixes and translate more strings.
* Fix finding translations with escaped characters.
* Add back \r to translations since its needed by screen.
2018-08-09 13:29:30 -07:00
Dan Halbert bc760dd341 WIP: complete manual inspection of all significant changes 2018-07-23 21:34:25 -04:00
Matt Wozniski 1c35dbfb5d Provide mp_errno_to_str even without uerrno
We can provide a basic version of mp_errno_to_str even if the uerrno
module won't be provided.  Rather than looking errno names up in the
uerrno module's globals dict, we'll just rely on a simple mapping in the
function itself.
2018-06-01 19:03:51 -04:00
Matt Wozniski 5833cbe6de Display human readable strings for common OSErrors
Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
2018-05-14 15:12:40 -04:00
Damien George b1b090255c py/moduerrno: Make list of errno codes configurable.
It's configurable by defining MICROPY_PY_UERRNO_LIST.  If this is not
defined then a default is provided.
2017-02-22 12:58:11 +11:00
Damien George f563406d2e py/moduerrno: Make uerrno.errorcode dict configurable.
It's configured by MICROPY_PY_UERRNO_ERRORCODE and enabled by default
(since that's the behaviour before this patch).

Without this dict the lookup of errno codes to strings must use the
uerrno module itself.
2017-02-22 12:58:11 +11:00
Damien George 93c4a6a3f7 all: Remove 'name' member from mp_obj_module_t struct.
One can instead lookup __name__ in the modules dict to get the value.
2016-09-22 00:23:16 +10:00
Paul Sokolovsky 2ec0ee082a py/moduerrno: Add ECONNREFUSED, one of frequent networking errors. 2016-05-28 00:17:19 +03:00
Paul Sokolovsky c76acd8c23 py/moduerrno: Add EEXIST, EISDIR.
Useful to check file/dir operations result, in particular used by upip.
2016-05-25 01:23:57 +03:00
Paul Sokolovsky 10503f3534 py/moduerrno: Add EACCES, pretty common error on Unix. 2016-05-13 00:15:38 +03:00
Damien George 9a92499641 py/objexcept: Don't convert errno to str in constructor, do it in print.
OSError's are now printed like:

    OSError: [Errno 1] EPERM

but only if the string corresponding to the errno is found.
2016-05-12 14:27:52 +01:00
Damien George d45e5f8c35 py: Add mp_errno_to_str() and use it to provide nicer OSError msgs.
If an OSError is raised with an integer argument, and that integer
corresponds to an errno, then the string for the errno is used as the
argument to the exception, instead of the integer.  Only works if
the uerrno module is enabled.
2016-05-12 13:20:40 +01:00
Damien George 47bf6ba61a py/moduerrno: Add more constants to the errno module. 2016-05-12 13:18:48 +01:00
Damien George 596a3feb8f py: Add uerrno module, with errno constants and dict. 2016-05-10 23:30:39 +01:00