Version 3.5.0
3.5.0 (9 May 2021)
New:
-
Add
temporary_module
, a context manager that usescreate_module
, and automatically removes the temporary module fromsys.modules
when the context exits. -
Add a global postprocessor hook facility. Hooks are called, in the order registered, by
global_postprocess
when the macro expansion of a module is otherwise done. This e.g. allows a macro library to use its ownASTMarker
subclasses for internal communication between macros, and delete (only) its own markers when done. Seeadd_postprocessor
andremove_postprocessor
inmcpyrate.core
.
Fixed:
-
Run-time part of
n[]
: upon a parse error, make it clearer in the error message that what was being compiled was an invocation ofn[]
, not the whole source file. (Because these expressions are often one-liners, usuallylineno
will be1
, which otherwise looks confusing.) -
Fix error message in run-time typecheck of
a
(ast-unquote). Now it mentions correctly what was expected. -
Now
ASTMarker
may contain a statement suite (list
of AST nodes) as itsbody
.- The debug mode of
mcpyrate.unparse
now renders such bodies correctly. mcpyrate.markers.delete_markers
now deletes such markers correctly, splicing in thelist
of AST nodes where the marker was.
- The debug mode of