summaryrefslogtreecommitdiffstatshomepage
path: root/py/builtinhelp.c
Commit message (Collapse)AuthorAge
* py: Make mp_obj_get_type() return a const ptr to mp_obj_type_t.Damien George2020-01-09
| | | | | | Most types are in rodata/ROM, and mp_obj_base_t.type is a constant pointer, so enforce this const-ness throughout the code base. If a type ever needs to be modified (eg a user type) then a simple cast can be used.
* py: Automatically provide weak links from "foo" to "ufoo" module name.Damien George2019-10-22
| | | | | | | | | | | | | | | | | | | | | | | | | | This commit implements automatic module weak links for all built-in modules, by searching for "ufoo" in the built-in module list if "foo" cannot be found. This means that all modules named "ufoo" are always available as "foo". Also, a port can no longer add any other weak links, which makes strict the definition of a weak link. It saves some code size (about 100-200 bytes) on ports that previously had lots of weak links. Some changes from the previous behaviour: - It doesn't intern the non-u module names (eg "foo" is not interned), which saves code size, but will mean that "import foo" creates a new qstr (namely "foo") in RAM (unless the importing module is frozen). - help('modules') no longer lists non-u module names, only the u-variants; this reduces duplication in the help listing. Weak links are effectively the same as having a set of symbolic links on the filesystem that is searched last. So an "import foo" will search built-in modules first, then all paths in sys.path, then weak links last, importing "ufoo" if it exists. Thus a file called "foo.py" somewhere in sys.path will still have precedence over the weak link of "foo" to "ufoo". See issues: #1740, #4449, #5229, #5241.
* py: Downcase MP_xxx_SLOT_IS_FILLED inline functions.Damien George2019-02-12
|
* py/builtinhelp: Only print help re FS modules if external import enabledYonatan Goldschmidt2019-02-06
|
* py: Simplify some cases of accessing the map of module and type dict.Damien George2018-07-08
| | | | | | | mp_obj_module_get_globals() returns a mp_obj_dict_t*, and type->locals_dict is a mp_obj_dict_t*, so access the map entry of the dict directly instead of needing to cast this mp_obj_dict_t* up to an object and then calling the mp_obj_dict_get_map() helper function.
* py/builtinhelp: Change occurrence of mp_uint_t to size_t.Damien George2018-05-02
|
* py/objstr: Remove "make_qstr_if_not_already" arg from mp_obj_new_str.Damien George2017-11-16
| | | | | | | | | | | This patch simplifies the str creation API to favour the common case of creating a str object that is not forced to be interned. To force interning of a new str the new mp_obj_new_str_via_qstr function is added, and should only be used if warranted. Apart from simplifying the mp_obj_new_str function (and making it have the same signature as mp_obj_new_bytes), this patch also reduces code size by a bit (-16 bytes for bare-arm and roughly -40 bytes on the bare-metal archs).
* py/builtinhelp: Change signature of help text var from pointer to array.Damien George2017-09-12
| | | | | As a pointer (const char *) it takes up an extra word of storage which is in RAM.
* py/builtinhelp: Simplify code slightly by extracting object type.Damien George2017-09-10
| | | | Reduces code size by about 10 bytes.
* py/builtinhelp: Implement help('modules') to list available modules.Damien George2017-01-22
| | | | | | | | This is how CPython does it, and it's very useful to help users discover the available modules for a given port, especially built-in and frozen modules. The function does not list modules that are in the filesystem because this would require a fair bit of work to do correctly, and is very port specific (depending on the filesystem).
* py: Add builtin help function to core, with default help msg.Damien George2017-01-22
This builtin is configured using MICROPY_PY_BUILTINS_HELP, and is disabled by default.