diff options
Diffstat (limited to 'Lib/compiler')
-rw-r--r-- | Lib/compiler/misc.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/compiler/misc.py b/Lib/compiler/misc.py index 9cbd73f..b4bbe78 100644 --- a/Lib/compiler/misc.py +++ b/Lib/compiler/misc.py @@ -64,3 +64,12 @@ def mangle(name, klass): klass = klass[:MANGLE_LEN-tlen] return "_%s%s" % (klass, name) + +def set_filename(filename, tree): + """Set the filename attribute to filename on every node in tree""" + worklist = [tree] + while worklist: + node = worklist.pop(0) + node.filename = filename + worklist.extend(node.getChildNodes()) + |