Re: Garbage collection problem with generators

2016-12-28 Thread Haochuan Guo
Sorry about breaking the rule. I'm just curios about this problem. And I'm using this workaround to prevent redundant resource creation. https://gist.githubusercontent.com/wooparadog/16948ca6c8ffb22214bf491a280406da/raw/- On Wed, Dec 28, 2016 at 9:12 PM Chris Angelico wrote: > On Wed, Dec 28,

Re: Garbage collection problem with generators

2016-12-28 Thread Chris Angelico
On Wed, Dec 28, 2016 at 9:03 PM, Haochuan Guo wrote: > Anyone? The script to reproduce this problem is in: > > https://gist.github.com/wooparadog/766f8007d4ef1227f283f1b040f102ef > > On Fri, Dec 23, 2016 at 8:39 PM Haochuan Guo wrote: > >> This is reproducible with python2.7, but not in python3.5

Re: Garbage collection problem with generators

2016-12-28 Thread Haochuan Guo
Anyone? The script to reproduce this problem is in: https://gist.github.com/wooparadog/766f8007d4ef1227f283f1b040f102ef On Fri, Dec 23, 2016 at 8:39 PM Haochuan Guo wrote: > Hi, everyone > > I'm building a http long polling client for our company's discovery > service and something weird happen

Garbage collection problem with generators

2016-12-23 Thread Haochuan Guo
Hi, everyone I'm building a http long polling client for our company's discovery service and something weird happened in the following code: ```python while True: try: r = requests.get("url", stream=True, timeout=3) for data in r.iter_lines(): processing_data...