Skip to content

Commit cac17f4

Browse files
committed
improves error traceback
1 parent 7f8de8d commit cac17f4

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

redis/asyncio/lock.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def __init__(
131131
token is *not* stored in thread local storage, then
132132
thread-1 would see the token value as "xyz" and would be
133133
able to successfully release the thread-2's lock.
134-
134+
135135
``raise_on_release_error`` indicates whether to raise an exception when
136136
the lock is no longer owned when exiting the context manager. By default,
137137
this is True, meaning an exception will be raised. If False, the warning
@@ -175,12 +175,11 @@ async def __aenter__(self):
175175
async def __aexit__(self, exc_type, exc_value, traceback):
176176
try:
177177
await self.release()
178-
except LockNotOwnedError as e:
178+
except LockNotOwnedError:
179179
if self.raise_on_release_error:
180180
raise
181181
logger.warning("Lock was no longer owned when exiting context manager.")
182182

183-
184183
async def acquire(
185184
self,
186185
blocking: Optional[bool] = None,

redis/lock.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,9 @@ def __exit__(
180180
) -> None:
181181
try:
182182
self.release()
183-
except LockNotOwnedError as e:
183+
except LockNotOwnedError:
184184
if self.raise_on_release_error:
185-
raise e
185+
raise
186186
logger.warning("Lock was no longer owned when exiting context manager.")
187187

188188
def acquire(

0 commit comments

Comments
 (0)