From 0ffe4b6724d9aaacd764ea1e36e8b775d9ab3ee9 Mon Sep 17 00:00:00 2001 From: Paul McGuire Date: Fri, 13 May 2016 08:52:57 +0000 Subject: Minor enhancement to traceParseAction decorator, to retain the parse action's name for the trace output Some rework of unitTests.py, to simplify test suite building --- src/pyparsing.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/pyparsing.py') diff --git a/src/pyparsing.py b/src/pyparsing.py index 18f788a..3c0e13f 100644 --- a/src/pyparsing.py +++ b/src/pyparsing.py @@ -58,7 +58,7 @@ The pyparsing module handles some of the problems that are typically vexing when """ __version__ = "2.1.4" -__versionTime__ = "12 May 2016 18:38 UTC" +__versionTime__ = "13 May 2016 08:50 UTC" __author__ = "Paul McGuire " import string @@ -835,6 +835,16 @@ def _trim_arity(func, maxargs=2): limit[0] += 1 continue raise + + # copy func name to wrapper for sensible debug output + func_name = "" + try: + func_name = getattr(func, '__name__', + getattr(func, '__class__').__name__) + except Exception: + func_name = str(func) + wrapper.__name__ = func_name + return wrapper class ParserElement(object): -- cgit v1.2.1