If I read Modules/cStringIO.c
correctly, this should be quite efficient (although somewhat verbose):
from cStringIO import StringIO
def iterbuf(buf):
stri = StringIO(buf)
while True:
nl = stri.readline()
if nl != '':
yield nl.strip()
else:
raise StopIteration