Spot the bug in the file-line generator

from Generators and iterators
Python 3.14 intermediate 4 min 1 issue to find

Find why this helper fails only when its result is consumed.

Python
def read_lines(path):
    with open(path, encoding="utf-8") as source:
        return (line.rstrip() for line in source)
Open in playground
Report an error