Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SyntaxError on python 2.7.5 #1545

Merged
merged 1 commit into from
May 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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