mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2026-10-24 14:17:41 -05:00
Rename caught exception for use outside the except: block.
In Python 3, the variable with the currently handled exception is unset at the end of the except block. (This is done to break reference cycles, since exception instances now carry tracebacks, which contain all locals.) Fix this in baseldap's error handler. Use a simpler structure for the ipatests.raises utility that only uses the exception inside the except block. Reviewed-By: Tomas Babej <tbabej@redhat.com>
This commit is contained in:
1 parent
929c3d1265
commit
88ac1c1616
2 files changed
+4
-6
No files matched your search
@@ -1148,7 +1148,8 @@ last, after all sets and adds."""),
|
||||
while True:
|
||||
try:
|
||||
return func(*call_args, **call_kwargs)
|
||||
except errors.ExecutionError as e:
|
||||
except errors.ExecutionError as exc:
|
||||
e = exc
|
||||
if not callbacks:
|
||||
raise
|
||||
# call exc_callback in the next loop
|
||||
|
||||
+2
-5
@@ -370,14 +370,11 @@ def raises(exception, callback, *args, **kw):
|
||||
Tests that the expected exception is raised; raises ExceptionNotRaised
|
||||
if test fails.
|
||||
"""
|
||||
raised = False
|
||||
try:
|
||||
callback(*args, **kw)
|
||||
except exception as e:
|
||||
raised = True
|
||||
if not raised:
|
||||
raise ExceptionNotRaised(exception)
|
||||
return e
|
||||
return e
|
||||
raise ExceptionNotRaised(exception)
|
||||
|
||||
|
||||
def getitem(obj, key):
|
||||
|
||||
Reference in new issue
Block a user