Skip to content

Commit be3ec97

Browse files
authored
Merge pull request #154 from c10udlnk/master
Fix dumping co_varnames
2 parents 6c8fab7 + 4b27ff8 commit be3ec97

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

xdis/marsh.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,12 @@ def dump_code2(self, x):
327327
for name in x.co_names:
328328
self.dump_string(name)
329329

330-
self.dump(x.co_varnames)
330+
# The tuple "varnames" in Python2 also must have string entries
331+
self._write(TYPE_TUPLE)
332+
self.w_long(len(x.co_varnames))
333+
for name in x.co_varnames:
334+
self.dump_string(name)
335+
331336
self.dump(x.co_freevars)
332337
self.dump(x.co_cellvars)
333338
self.dump_string(x.co_filename)

0 commit comments

Comments
 (0)