summaryrefslogtreecommitdiff
path: root/py/objmodule.c
AgeCommit message (Collapse)Author
2019-05-17various: Add and update my copyright line based on git history.Paul Sokolovsky
For modules I initially created or made substantial contributions to.
2019-03-08py: Update and rework build system for including external C modules.Andrew Leech
How to use this feature is documented in docs/develop/cmodules.rst.
2019-03-08py: Implement a module system for external, user C modules.Ayke van Laethem
This system makes it a lot easier to include external libraries as static, native modules in MicroPython. Simply pass USER_C_MODULES (like FROZEN_MPY_DIR) as a make parameter.
2019-03-08py: Allow registration of modules at their definition.Andrew Leech
During make, makemoduledefs.py parses the current builds c files for MP_REGISTER_MODULE(module_name, obj_module, enabled_define) These are used to generate a header with the required entries for "mp_rom_map_elem_t mp_builtin_module_table[]" in py/objmodule.c
2019-02-14extmod/moduwebsocket: Refactor `websocket` to `uwebsocket`.Yonatan Goldschmidt
As mentioned in #4450, `websocket` was experimental with a single intended user, `webrepl`. Therefore, we'll make this change without a weak link `websocket` -> `uwebsocket`.
2018-10-23py/objmodule: Implement PEP 562's __getattr__ for modules.Paul m. p. P
Configurable via MICROPY_MODULE_GETATTR, disabled by default. Among other things __getattr__ for modules can help to build lazy loading / code unloading at runtime.
2018-09-27py/objmodule: Remove TODO about checking store attr to a module.Damien George
The code implements correct behaviour, as tested by basics/module1.py.
2018-07-08py/objmodule: Make mp_obj_module_get_globals an inline function.Damien George
Because this function is simple it saves code size to have it inlined. Being an auxiliary helper function (and only used in the py/ core) the argument should always be an mp_obj_module_t*, so there's no need for the assert (and having it would require including assert.h in obj.h).
2018-06-27extmod/moducryptolib: Add ucryptolib module with crypto functions.Paul Sokolovsky
The API follows guidelines of https://www.python.org/dev/peps/pep-0272/, but is optimized for code size, with the idea that full PEP 0272 compatibility can be added with a simple Python wrapper mode. The naming of the module follows (u)hashlib pattern. At the bare minimum, this module is expected to provide: * AES128, ECB (i.e. "null") mode, encrypt only Implementation in this commit is based on axTLS routines, and implements following: * AES 128 and 256 * ECB and CBC modes * encrypt and decrypt
2018-02-20py/objmodule: Factor common code for calling __init__ on builtin module.Damien George
2017-10-04all: Remove inclusion of internal py header files.Damien George
Header files that are considered internal to the py core and should not normally be included directly are: py/nlr.h - internal nlr configuration and declarations py/bc0.h - contains bytecode macro definitions py/runtime0.h - contains basic runtime enums Instead, the top-level header files to include are one of: py/obj.h - includes runtime0.h and defines everything to use the mp_obj_t type py/runtime.h - includes mpstate.h and hence nlr.h, obj.h, runtime0.h, and defines everything to use the general runtime support functions Additional, specific headers (eg py/objlist.h) can be included if needed.
2017-07-31all: Use the name MicroPython consistently in commentsAlexander Steffen
There were several different spellings of MicroPython present in comments, when there should be only one.
2017-01-26py/objmodule: Move module init/deinit code into runtime functions.Damien George
They are one-line functions and having them inline in mp_init/mp_deinit eliminates the overhead of a function call, and matches how other state is initialised in mp_init.
2017-01-22py: Move weak-link map to objmodule.c, and expose module maps as public.Damien George
2016-12-22extmod/modutimeq: Refactor into optimized class.Paul Sokolovsky
import utimeq, utime # Max queue size, the queue allocated statically on creation q = utimeq.utimeq(10) q.push(utime.ticks_ms(), data1, data2) res = [0, 0, 0] # Items in res are filled up with results q.pop(res)
2016-11-21stmhal/moduselect: Move to extmod/ for reuse by other ports.Paul Sokolovsky
2016-09-22all: Remove 'name' member from mp_obj_module_t struct.Damien George
One can instead lookup __name__ in the modules dict to get the value.
2016-06-28py: Add basic _thread module, with ability to start a new thread.Damien George
2016-06-15py: Support to build berkeley db 1.85 and "btree" module.Paul Sokolovsky
2016-05-10py: Add uerrno module, with errno constants and dict.Damien George
2016-05-02py/modcollections: Rename module name have "u" prefix for consistency.Paul Sokolovsky
2016-05-02py/modio: Rename module name to "uio" for consistency with other modules.Paul Sokolovsky
2016-04-29extmod/modwebrepl: Module to handle WebREPL protocol.Paul Sokolovsky
While just a websocket is enough for handling terminal part of WebREPL, handling file transfer operations requires demultiplexing and acting upon, which is encapsulated in _webrepl class provided by this module, which wraps a websocket object.
2016-04-12extmod: Add initial framebuf module.Damien George
2016-03-24extmod/modwebsocket: Start module for WebSocket helper functions.Paul Sokolovsky
Currently, only write support is implemented (of limited buffer size).
2016-01-17extmod/modurandom: Add "urandom" module.Paul Sokolovsky
Seedable and reproducible pseudo-random number generator. Implemented functions are getrandbits(n) (n <= 32) and seed(). The algorithm used is Yasmarang by Ilya Levin: http://www.literatecode.com/yasmarang
2015-12-13unix: Move modmachine into unix directoryDave Hylands
This leaves behind the common functionality in extmod/machine_mem.c which can be used by all ports.
2015-12-07py: Make it easy to build without MICROPY_PY_BUILTINS_COMPLEX.Paul Sokolovsky
Automagically skip related modules.
2015-12-05py/modsys: Implement sys.modules.Paul Sokolovsky
This for example will allow people to reload modules which didn't load successfully (e.g. due to syntax error).
2015-11-29py: Wrap all obj-ptr conversions in MP_OBJ_TO_PTR/MP_OBJ_FROM_PTR.Damien George
This allows the mp_obj_t type to be configured to something other than a pointer-sized primitive type. This patch also includes additional changes to allow the code to compile when sizeof(mp_uint_t) != sizeof(void*), such as using size_t instead of mp_uint_t, and various casts.
2015-11-29py: Add MP_ROM_* macros and mp_rom_* types and use them.Damien George
2015-10-27extmod/modlwip: slip: Use stream protocol and be port-independent.Paul Sokolovsky
Based on the original patch by Galen Hazelwood: https://github.com/micropython/micropython/pull/1517 .
2015-10-12py: Add support to call __init__ from a builtin module on first import.Damien George
2015-10-06modussl: SSL socket wrapper module based on axTLS.Paul Sokolovsky
2015-05-04modstruct: Rename module to "ustruct", to allow full Python-level impl.Paul Sokolovsky
2015-05-04modmachine: Add new module to access hardware, starting with physical memory.Paul Sokolovsky
Refactored from "stm" module, provides mem8, mem16, mem32 objects with array subscript syntax.
2015-04-16py: Add %q format support to mp_[v]printf, and use it.Damien George
2015-04-16py: Overhaul and simplify printf/pfenv mechanism.Damien George
Previous to this patch the printing mechanism was a bit of a tangled mess. This patch attempts to consolidate printing into one interface. All (non-debug) printing now uses the mp_print* family of functions, mainly mp_printf. All these functions take an mp_print_t structure as their first argument, and this structure defines the printing backend through the "print_strn" function of said structure. Printing from the uPy core can reach the platform-defined print code via two paths: either through mp_sys_stdout_obj (defined pert port) in conjunction with mp_stream_write; or through the mp_plat_print structure which uses the MP_PLAT_PRINT_STRN macro to define how string are printed on the platform. The former is only used when MICROPY_PY_IO is defined. With this new scheme printing is generally more efficient (less layers to go through, less arguments to pass), and, given an mp_print_t* structure, one can call mp_print_str for efficiency instead of mp_printf("%s", ...). Code size is also reduced by around 200 bytes on Thumb2 archs.
2015-04-11py: Combine load_attr and store_attr type methods into one (attr).Damien George
This simplifies the API for objects and reduces code size (by around 400 bytes on Thumb2, and around 2k on x86). Performance impact was measured with Pystone score, but change was barely noticeable.
2015-03-20py: Implement core of OrderedDict type.Paul Sokolovsky
Given that there's already support for "fixed table" maps, which are essentially ordered maps, the implementation of OrderedDict just extends "fixed table" maps by adding an "is ordered" flag and add/remove operations, and reuses 95% of objdict code, just making methods tolerant to both dict and OrderedDict. Some things are missing so far, like CPython-compatible repr and comparison. OrderedDict is Disabled by default; enabled on unix and stmhal ports.
2015-01-20py, unix: Allow to compile with -Wunused-parameter.Damien George
See issue #699.
2015-01-20py, unix, stmhal: Allow to compile with -Wshadow.Damien George
See issue #699.
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-12-09py: Allow builtins to be overridden.Damien George
This patch adds a configuration option (MICROPY_CAN_OVERRIDE_BUILTINS) which, when enabled, allows to override all names within the builtins module. A builtins override dict is created the first time the user assigns to a name in the builtins model, and then that dict is searched first on subsequent lookups. Note that this implementation doesn't allow deleting of names. This patch also does some refactoring of builtins code, creating the modbuiltins.c file. Addresses issue #959.
2014-11-05unix: fast: Set initial module dict size big to have high pystone score.Paul Sokolovsky
For this, introduce MICROPY_MODULE_DICT_SIZE config setting.
2014-09-08py: Print imported module's location (__file__) if available.Damien George
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-04-08py: Finish implementation of all del opcodes.Damien George
At this point, all opcodes are now implemented! Some del opcodes have been combined with store opcodes, with the value to store being MP_OBJ_NULL.