Skip to content

Commit 53229c6

Browse files
committed
improves error traceback
1 parent 62cdb7c commit 53229c6

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
@@ -130,7 +130,7 @@ def __init__(
130130
token is *not* stored in thread local storage, then
131131
thread-1 would see the token value as "xyz" and would be
132132
able to successfully release the thread-2's lock.
133-
133+
134134
``raise_on_release_error`` indicates whether to raise an exception when
135135
the lock is no longer owned when exiting the context manager. By default,
136136
this is True, meaning an exception will be raised. If False, the warning
@@ -174,12 +174,11 @@ async def __aenter__(self):
174174
async def __aexit__(self, exc_type, exc_value, traceback):
175175
try:
176176
await self.release()
177-
except LockNotOwnedError as e:
177+
except LockNotOwnedError:
178178
if self.raise_on_release_error:
179179
raise
180180
logger.warning("Lock was no longer owned when exiting context manager.")
181181

182-
183182
async def acquire(
184183
self,
185184
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)