Merge branch 'master' of github.com:mitsuhiko/flask

This commit is contained in:
Jimmy McCarthy 2015-09-14 13:06:54 -05:00
commit 04a3eeee3b
7 changed files with 38 additions and 29 deletions

View file

@ -54,23 +54,14 @@ else:
def with_metaclass(meta, *bases):
"""Create a base class with a metaclass."""
# This requires a bit of explanation: the basic idea is to make a
# dummy metaclass for one level of class instantiation that replaces
# itself with the actual metaclass. Because of internal type checks
# we also need to make sure that we downgrade the custom metaclass
# for one level to something closer to type (that's why __call__ and
# __init__ comes back from type etc.).
#
# This has the advantage over six.with_metaclass in that it does not
# introduce dummy classes into the final MRO.
class metaclass(meta):
__call__ = type.__call__
__init__ = type.__init__
# itself with the actual metaclass.
class metaclass(type):
def __new__(cls, name, this_bases, d):
if this_bases is None:
return type.__new__(cls, name, (), d)
return meta(name, bases, d)
return metaclass('temporary_class', None, {})
return type.__new__(metaclass, 'temporary_class', (), {})
# Certain versions of pypy have a bug where clearing the exception stack

View file

@ -1771,8 +1771,9 @@ class Flask(_PackageBoundObject):
rv = handler(error, endpoint, values)
if rv is not None:
return rv
except BuildError as error:
pass
except BuildError as e:
# make error available outside except block (py3)
error = e
# At this point we want to reraise the exception. If the error is
# still the same one we can reraise it with the original traceback,