Fixed a subtle but huge bug in threado, caused by inadvertently breaking one invariant of the whole system: Two GeneratorStream steps won't be running at the same time. The problem manifested in the following bit of threado:             for other in next:                 if other in callbacks:                     old_callbacks.discard(other)                 else:                     callqueue.add(cls.step, gen, inner, callbacks, fast, other) This moment here >>>>>>>>>>>>                     callbacks[other] = None
Fixed a subtle but huge bug in threado, caused by inadvertently breaking one invariant of the whole system: Two GeneratorStream steps won't be running at the same time. The problem manifested in the following bit of threado:
            for other in next:
                if other in callbacks:
                    old_callbacks.discard(other)
                else:
                    callqueue.add(cls.step, gen, inner, callbacks, fast, other)
This moment here >>>>>>>>>>>>
                    callbacks[other] = None

When a threado.stream is started, the first iteration of the generator thread was run immediately - even if there were other ones running at the same time. Basically, if the next iteration of the same generator's step function was run at the indicated spot, it might check that no, this current source is not in the callbacks dict, thus halting the whole generator's future iterations.

There was a simple fix: Just run the first iteration in the callqueue. This guaranteed (hey, one can hope ;) that two step iterations won't be run at the same time.

abusesa/idiokit