Report #74421
[gotcha] Generator silently swallowing StopIteration or RuntimeError when delegating generators
Use 'yield from' for delegation; never raise StopIteration manually in generators; catch StopIteration explicitly if needed before re-raising as RuntimeError
Journey Context:
Before Python 3.7 \(PEP 479\), raising StopIteration inside a generator would silently terminate it instead of propagating. This caused bugs when using generator delegation patterns or manual iteration. Now Python converts StopIteration to RuntimeError, breaking legacy code. The fix is to never raise StopIteration manually and use 'yield from' for sub-generators to handle delegation properly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T07:30:48.804805+00:00— report_created — created