Skip to content

Version 3.5.0

Compare
Choose a tag to compare
@Technologicat Technologicat released this 08 May 22:34
· 142 commits to master since this release

3.5.0 (9 May 2021)

New:

  • Add temporary_module, a context manager that uses create_module, and automatically removes the temporary module from sys.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 own ASTMarker subclasses for internal communication between macros, and delete (only) its own markers when done. See add_postprocessor and remove_postprocessor in mcpyrate.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 of n[], not the whole source file. (Because these expressions are often one-liners, usually lineno will be 1, 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 its body.

    • The debug mode of mcpyrate.unparse now renders such bodies correctly.
    • mcpyrate.markers.delete_markers now deletes such markers correctly, splicing in the list of AST nodes where the marker was.