Skip to content
Myr

fix UnboundLocalError in handle_url_build_error

Before adoption: this commit came in with the history the project adopted, so no landing records it.

- caused by changes in the execution model of python 3 where the alias of an except clause is cleared on exit of the except

authored by Christian Becker · committed by Markus Unterwaditzer · parent d734baf · Browse files · 2 files+14 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+14 added−2 removed

  • other:+14 added−2 removed

2 files+14 added−2 removed

modified:flask/testsuite/basic.py+11 added
770 unmodified lines
771 app.url_build_error_handlers.append(handler)772 with app.test_request_context():773 self.assert_equal(flask.url_for('spam'), '/test_handler/')774775 def test_build_error_handler_reraise(self):776 app = flask.Flask(__name__)777778 # Test a custom handler which reraises the BuildError779 def handler_raises_build_error(error, endpoint, values):780 raise error781 app.url_build_error_handlers.append(handler_raises_build_error)782783 with app.test_request_context():784 self.assertRaises(BuildError, flask.url_for, 'not.existing')785786 def test_custom_converters(self):787 from werkzeug.routing import BaseConverter788 class ListConverter(BaseConverter):789 def to_python(self, value):
497 unmodified lines
modified:flask/app.py+3 added-2 removed
1629 unmodified lines
1630 try:1631 rv = handler(error, endpoint, values)1632 if rv is not None:1633 return rv1634 except BuildError as error:1635 pass1634 except BuildError as e:1635 # make error available outside except block (py3)1636 error = e16371638 # At this point we want to reraise the exception. If the error is1639 # still the same one we can reraise it with the original traceback,1640 # otherwise we raise it from here.
203 unmodified lines