Skip to content

Commit bff8cd8

Browse files
committed
Avoid redundant UnboundLocalError
1 parent 5f22326 commit bff8cd8

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

extraasync/sync_async_bridge.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def _sync_to_async_non_bridge(
158158
Error trying to create a new async loop - to be able to call 'sync_to_async' from
159159
code inside a running async loop, the parent 'sync execution branch' must be called
160160
with `extraasync.async_to_sync`.
161-
"""
161+
"""
162162
)
163163
)
164164
_non_bridge_loop.set(loop)
@@ -222,8 +222,8 @@ def __repr__(self):
222222

223223

224224
def _in_context_sync_worker(sync_task: _SyncTask):
225-
226225
_context_bound_task.set(sync_task)
226+
result = None
227227
try:
228228
logger.debug("Entering sync call in worker thread")
229229
result = sync_task.sync_task(*sync_task.args, **sync_task.kwargs)
@@ -284,7 +284,6 @@ def async_to_sync(
284284
Returns a future that will contain the results of the synchronous call
285285
"""
286286
logger.debug("Starting async_to_sync call to %s", func)
287-
288287
if kwargs is None:
289288
kwargs = {}
290289

0 commit comments

Comments
 (0)