Skip to content

Commit

Permalink
Fix for Python 3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
dmaxson committed Mar 1, 2018
1 parent 53571d7 commit 6e6a8f4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pragma/lift.py
@@ -1,6 +1,7 @@
import ast
import astor
import tempfile
import sys
from miniutils import magic_contract, optional_argument_decorator
from types import ModuleType

Expand All @@ -9,6 +10,10 @@
from .core.resolve import make_ast_from_literal

_exclude = {'__builtin__', '__builtins__', 'builtin', 'builtins'}
if sys.version_info < (3, 6):
_ast_str_types = ast.Str
else:
_ast_str_types = (ast.Str, ast.JoinedStr)


@optional_argument_decorator
Expand Down Expand Up @@ -59,7 +64,7 @@ def inner(f):
else:
free_vars.append((k, v))

if isinstance(f_body[0], ast.Expr) and isinstance(f_body[0].value, (ast.Str, ast.JoinedStr)):
if isinstance(f_body[0], ast.Expr) and isinstance(f_body[0].value, _ast_str_types):
f_docstring = f_body[:1]
f_body = f_body[1:]
else:
Expand Down

0 comments on commit 6e6a8f4

Please sign in to comment.