Skip to content

Commit

Permalink
Merge pull request #68 from pypr/fix-py39
Browse files Browse the repository at this point in the history
Fixes for changes in Python 3.9+ and test 3.9.x.
  • Loading branch information
prabhuramachandran committed Nov 28, 2020
2 parents 5bf7ced + fb476b6 commit 22c77ee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ language: python
python:
- 3.7
- 3.8
- 3.9

install:
- sudo apt-get update
Expand Down
6 changes: 5 additions & 1 deletion compyle/translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,8 +700,12 @@ def visit_Str(self, node):
return r'"%s"' % node.s

def visit_Subscript(self, node):
if sys.version_info >= (3, 9):
sliceval = node.slice
else:
sliceval = node.slice.value
return '%s[%s]' % (
self.visit(node.value), self.visit(node.slice.value)
self.visit(node.value), self.visit(sliceval)
)

def visit_TryExcept(self, node):
Expand Down

0 comments on commit 22c77ee

Please sign in to comment.