mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06: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:
committed by
Tomas Babej
parent
929c3d1265
commit
88ac1c1616
@@ -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