From d86d1b15b7b67d8eedbc72bafd5e95884153cd3c Mon Sep 17 00:00:00 2001 From: Juha Jeronen Date: Thu, 26 Sep 2024 16:08:01 +0300 Subject: [PATCH] update docstring --- mcpyrate/debug.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/mcpyrate/debug.py b/mcpyrate/debug.py index a7d3dc6..1c55fed 100644 --- a/mcpyrate/debug.py +++ b/mcpyrate/debug.py @@ -219,13 +219,15 @@ class SourceLocationInfoValidator(ASTVisitor): print(v.collected) It's a rather common occurrence when developing macros to have the source - location info missing somewhere, but when we `compile`, Python won't tell us - *which* nodes are missing them. + location info missing somewhere, but when we `compile`, Python (up to 3.10) + won't tell us *which* nodes are missing them. This can also be used to debug whether the problem is what Python claims it is. - Python's `compile` is notorious for yelling about a missing source location - when the actual problem is that is got a bare value in a position where an - AST node was expected. + Python's `compile` (up to 3.10) is notorious for yelling about a missing + source location when the actual problem is that is got a bare value in a + position where an AST node was expected. + + Things might improve now that Python 3.11+ have AST validation in `compile`. The macro expander *should* fill in missing source location info when it expands a macro, so this utility will be needed only rarely.