[issue21984] list(itertools.repeat(1)) causes the system to hang

Josh Rosenberg report at bugs.python.org
Tue Jul 15 01:02:23 CEST 2014


Josh Rosenberg added the comment:

It's unlikely to have hung the system entirely. It will slow down a lot though, as it will consume ridiculous amounts of RAM, and occasionally involve copying the existing data due to reallocation. The cost of performing this pointless work may consume enough system resources that the OS responsiveness becomes intermittent, messages drop, etc. That's an inevitable consequence of running a program without a quota that intentionally consumes system resources indefinitely.

Python has no mechanism for identifying the difference between an infinitely long generator and a long but finite generator. Eventually, if you left the code running, it should eventually exhaust physical memory and the page file, then die with a MemoryError. But how long it takes to die is going to depend on the OS, page file configuration, etc.

----------
nosy: +josh.rosenberg

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21984>
_______________________________________


More information about the Python-bugs-list mailing list