Skip to content

Instantly share code, notes, and snippets.

@philmayers
Last active August 18, 2017 06:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save philmayers/387597c7407ab98f159426cea5f44a69 to your computer and use it in GitHub Desktop.
Save philmayers/387597c7407ab98f159426cea5f44a69 to your computer and use it in GitHub Desktop.
lxml & twisted trial crash repro
#!/usr/bin/env python
import io
from lxml import etree
def gen(f):
with etree.xmlfile(f, encoding='us-ascii', buffered=False) as xf:
xf.write_declaration()
with xf.element('tag'):
try:
while True:
el = (yield)
xf.write(el)
except GeneratorExit:
pass
g1 = gen(io.BytesIO())
next(g1)
g2 = gen(io.BytesIO())
next(g2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment