Skip to content

Commit 4cafc9d

Browse files
Linux UserLinux User
Linux User
authored and
Linux User
committed
modified fix_unpacking.py to support both the python2 unicode function and use the str function instead on python3
1 parent 80523f3 commit 4cafc9d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/libpasteurize/fixes/fix_unpacking.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,14 @@ def assignment_source(num_pre, num_post, LISTNAME, ITERNAME):
1818
Returns a source fit for Assign() from fixer_util
1919
"""
2020
children = []
21-
pre = unicode(num_pre)
22-
post = unicode(num_post)
21+
try:
22+
pre = unicode(num_pre)
23+
except NameError:
24+
pre = str(num_pre)
25+
try:
26+
post = unicode(num_post)
27+
except NameError:
28+
post = str(num_post)
2329
# This code builds the assignment source from lib2to3 tree primitives.
2430
# It's not very readable, but it seems like the most correct way to do it.
2531
if num_pre > 0:

0 commit comments

Comments
 (0)