Skip to content

Commit

Permalink
chore: refactor out unused c_logger constant (#489)
Browse files Browse the repository at this point in the history
* chore: refactor out unused c_logger constant

* fix: typo
  • Loading branch information
BobTheBuidler authored Dec 16, 2024
1 parent 5aa618e commit 6aedb43
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions a_sync/asyncio/create_task.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ from a_sync._typing import *

logger = logging.getLogger(__name__)

cdef object c_logger = logger


def create_task(
coro: Awaitable[T],
Expand Down Expand Up @@ -120,6 +118,9 @@ async def __await(awaitable: Awaitable[T]) -> T:
args.append(awaitable._children)
raise RuntimeError(*args) from None
cdef object __log_exception = logger.exception
cdef void __prune_persisted_tasks():
"""Remove completed tasks from the set of persisted tasks.
Expand All @@ -138,7 +139,7 @@ cdef void __prune_persisted_tasks():
if e := _get_exception(task):
# force exceptions related to this lib to bubble up
if not isinstance(e, exceptions.PersistedTaskException):
c_logger.exception(e)
__log_exception(e)
raise e
# we have to manually log the traceback that asyncio would usually log
# since we already got the exception from the task and the usual handler will now not run
Expand Down Expand Up @@ -193,4 +194,4 @@ async def __persisted_task_exc_wrap(task: "asyncio.Task[T]") -> T:
raise exceptions.PersistedTaskException(e, task) from e
__all__ = ["create_task"]
__all__ = ["create_task"]

0 comments on commit 6aedb43

Please sign in to comment.