Question about Task __prevHandler assignment

Hi, I was wondering why in direct/src/task/, near the beginning of the step(self) function, the self.__prevHandler is set to signal.signal(signal.SIGINT, self.keyboardInterruptHandler), which appears to be a full signal object itself, instead of just setting it to self.keyboardInterruptHandler which is just the handler that will be passed later.

I may just be missing context, but can you initialize a signal using another signal? If so, does it make sense to here, or would it be better to just set it to a handler func?

I looked into it more and saw that signal.signal(x,y) returns the previous handler. So the assignment makes sense here. I am concerned about the possibility of signal.signal(signal.SIGINT, self.keyboardInterruptHandler) returning None here, as I think it would cause an unhandled exception when signal.signal(signal.SIGINT, self.__prevHandler) shortly after. But maybe there’s a catch for that in some inner layer.