The deferred_init input argument to Task.init is bool by default, so checking type(deferred_init) == int makes no sense to begin with, and is altering the flow.
Oh this is so internally, the background thread can signal it is not deferred, are you saying there is bug or the code is odd?
@<1523701205467926528:profile|AgitatedDove14> this