summaryrefslogtreecommitdiff
path: root/ply
diff options
context:
space:
mode:
authorDavid Beazley <dave@dabeaz.com>2016-08-30 15:48:18 -0500
committerGitHub <noreply@github.com>2016-08-30 15:48:18 -0500
commit481413e07356a2f9b7cabd2e6fc34b43c1e791c7 (patch)
tree3f1ea52f0a4beac2b189ca6eb6c6f712fe460a43 /ply
parentb427e007362be3f749da875e570b7a5767e88d5a (diff)
parent5ab820632b54a330ceed4d0284e43221348a5b10 (diff)
downloadply-481413e07356a2f9b7cabd2e6fc34b43c1e791c7.tar.gz
Merge pull request #87 from bionikspoon/patch-1
Allow decorating production functions.
Diffstat (limited to 'ply')
-rw-r--r--ply/yacc.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/ply/yacc.py b/ply/yacc.py
index 41f4795..c1bea17 100644
--- a/ply/yacc.py
+++ b/ply/yacc.py
@@ -3119,7 +3119,7 @@ class ParserReflect(object):
if not name.startswith('p_') or name == 'p_error':
continue
if isinstance(item, (types.FunctionType, types.MethodType)):
- line = item.__code__.co_firstlineno
+ line = getattr(item, 'co_firstlineno', item.__code__.co_firstlineno)
module = inspect.getmodule(item)
p_functions.append((line, module, name, item.__doc__))