[George Yoshida] >> It does not always go into an infinite loop. I was bitten by this: >> >> >>> x = [] >> >>> x.extend(-y for y in x) >> Segmentation fault [Bob Ippolito] > No algorithm that requires infinite memory will run for an infinite > amount of time on a finite computer. Of course it should raise an > exception instead of segfaulting though.. could it be blowing the > stack? No, its stack use is bounded (and small) no matter how long it runs. On Windows it eventually raises MemoryError. My guess is that George is using Linux. "It's a feature" that the Linux malloc() can lie (== malloc(n) can return a non-NULL value p even if you're going to get a segfault if you try to write to p+i for some i in range(n)). Linus likens this to airlines over-selling seats, based on the likelihood that someone will miss their flight. Argue with him <wink>. When malloc() claims to return memory that can't actually be used, there's not much Python can do about that (other than blow up when trying to use it).
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4