Fix python3.x scoping issues with removed 'uee' variable
In python3.x the 'uee' variable will be removed from the scope after the except block exits (if it ever is entered) so we need to use a different variable name to ensure that it will not be deleted so we can use it later. Change-Id: Ia86a2bd1a46e57eaf47704eadc991fd0c9b08661
This commit is contained in:
parent
ed200283c1
commit
b1af0f5919
@ -200,14 +200,17 @@ class TestFallthroughsAndNonDBAPI(TestsExceptionFilter):
|
||||
# intentionally generate a UnicodeEncodeError, as its
|
||||
# constructor is quite complicated and seems to be non-public
|
||||
# or at least not documented anywhere.
|
||||
uee_ref = None
|
||||
try:
|
||||
six.u('\u2435').encode('ascii')
|
||||
except UnicodeEncodeError as uee:
|
||||
pass
|
||||
# Python3.x added new scoping rules here (sadly)
|
||||
# http://legacy.python.org/dev/peps/pep-3110/#semantic-changes
|
||||
uee_ref = uee
|
||||
|
||||
self._run_test(
|
||||
"postgresql", six.u('select \u2435'),
|
||||
uee,
|
||||
uee_ref,
|
||||
exception.DBInvalidUnicodeParameter
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user