Skip to content

Commit

Permalink
Fix SyntaxError on python 2.7.5
Browse files Browse the repository at this point in the history
  • Loading branch information
asottile committed May 15, 2019
1 parent c73923c commit d1efe0c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/werkzeug/routing.py
Expand Up @@ -852,6 +852,12 @@ def match(self, path, method=None):

return result

@staticmethod
def _get_func_code(code, name):
globs, locs = {}, {}
exec(code, globs, locs)
return locs[name]

def _compile_builder(self, append_unknown=True):
defaults = self.defaults or {}
dom_ops = []
Expand Down Expand Up @@ -943,11 +949,7 @@ def _join(parts):

module = ast.fix_missing_locations(ast.Module([func_ast]))
code = compile(module, "<werkzeug routing>", "exec")

globs, locs = {}, {}
exec(code, globs, locs)

return locs[func_ast.name]
return self._get_func_code(code, func_ast.name)

def build(self, values, append_unknown=True):
"""Assembles the relative url for that rule and the subdomain.
Expand Down

0 comments on commit d1efe0c

Please sign in to comment.