Removed some debugging code parts

This commit is contained in:
nocturn9x 2020-11-29 19:34:23 +01:00
parent 7a840d88be
commit 435ca2e47c
2 changed files with 11 additions and 8 deletions

View File

@ -159,7 +159,6 @@ class AsyncScheduler:
self.debugger.on_task_exit(self.current_task) self.debugger.on_task_exit(self.current_task)
self.join(self.current_task) self.join(self.current_task)
except BaseException as err: except BaseException as err:
raise
# Task raised an exception # Task raised an exception
self.current_task.exc = err self.current_task.exc = err
self.current_task.status = "crashed" self.current_task.status = "crashed"
@ -250,7 +249,7 @@ class AsyncScheduler:
if entry.exc: if entry.exc:
raise entry.exc raise entry.exc
def reschedule_joinee(self, task: Task): def reschedule_joiners(self, task: Task):
""" """
Reschedules the parent(s) of the Reschedules the parent(s) of the
given task, if any given task, if any
@ -336,13 +335,13 @@ class AsyncScheduler:
task.joined = True task.joined = True
if task.finished or task.cancelled: if task.finished or task.cancelled:
self.reschedule_joinee(task) self.reschedule_joiners(task)
elif task.exc: elif task.exc:
if not self.cancel_all_from_current_pool(): if not self.cancel_all_from_current_pool():
# This will reschedule the parent # This will reschedule the parent
# only if any enclosed pool has # only if any enclosed pool has
# already exited, which is what we want # already exited, which is what we want
self.reschedule_joinee(task) self.reschedule_joiners(task)
def sleep(self, seconds: int or float): def sleep(self, seconds: int or float):
""" """
@ -412,6 +411,7 @@ class AsyncScheduler:
# The socket is already registered doing something else # The socket is already registered doing something else
raise ResourceBusy("The given resource is busy!") from None raise ResourceBusy("The given resource is busy!") from None
# noinspection PyMethodMayBeStatic
async def read_sock(self, sock: socket.socket, buffer: int): async def read_sock(self, sock: socket.socket, buffer: int):
""" """
Reads from a socket asynchronously, waiting until the resource is Reads from a socket asynchronously, waiting until the resource is
@ -421,10 +421,11 @@ class AsyncScheduler:
await want_read(sock) await want_read(sock)
return sock.recv(buffer) return sock.recv(buffer)
# noinspection PyMethodMayBeStatic
async def accept_sock(self, sock: socket.socket): async def accept_sock(self, sock: socket.socket):
""" """
Accepts a socket connection asynchronously, waiting until the resource Accepts a socket connection asynchronously, waiting until the resource
is available and returning the result of the accept() call is available and returning the result of the sock.accept() call
""" """
# TODO: Is this ok? # TODO: Is this ok?
@ -439,6 +440,7 @@ class AsyncScheduler:
# so seemed to fix the issue, needs investigation # so seemed to fix the issue, needs investigation
await want_read(sock) await want_read(sock)
# noinspection PyMethodMayBeStatic
async def sock_sendall(self, sock: socket.socket, data: bytes): async def sock_sendall(self, sock: socket.socket, data: bytes):
""" """
Sends all the passed bytes trough a socket asynchronously Sends all the passed bytes trough a socket asynchronously
@ -460,6 +462,7 @@ class AsyncScheduler:
self.selector.unregister(sock) self.selector.unregister(sock)
self.current_task.last_io = () self.current_task.last_io = ()
# noinspection PyMethodMayBeStatic
async def connect_sock(self, sock: socket.socket, addr: tuple): async def connect_sock(self, sock: socket.socket, addr: tuple):
""" """
Connects a socket asynchronously Connects a socket asynchronously

View File

@ -37,7 +37,7 @@ class InternalError(GiambioError):
... ...
class CancelledError(BaseException): class CancelledError(GiambioError):
""" """
Exception raised by the giambio.objects.Task.cancel() method Exception raised by the giambio.objects.Task.cancel() method
to terminate a child task. This should NOT be caught, or to terminate a child task. This should NOT be caught, or
@ -69,8 +69,8 @@ class ErrorStack(GiambioError):
This exception wraps multiple exceptions This exception wraps multiple exceptions
and shows each individual traceback of them when and shows each individual traceback of them when
printed. This is to ensure that no exception is printed. This is to ensure that no exception is
ever lost even if 2 or more tasks raise at the lost even if 2 or more tasks raise at the
same time same time.
""" """
def __init__(self, errors: List[BaseException]): def __init__(self, errors: List[BaseException]):