On 1/13/2015 1:13 AM, Chris Angelico wrote:
On Tue, Jan 13, 2015 at 4:32 PM, Steven D'Aprano <st...@pearwood.info> wrote:
Crashing the interpreter from
pure Python code is *absolutely not allowed*, so anything which would
allow that is forbidden.

Except when you willingly shoot yourself in the foot.

rosuav@sikorsky:~$ python
Python 2.7.3 (default, Mar 13 2014, 11:03:55)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import sys
def f(): sys.setrecursionlimit(sys.getrecursionlimit()+1) or f()
...
f()
Segmentation fault
rosuav@sikorsky:~$ python3
Python 3.5.0a0 (default:1c51f1650c42+, Dec 29 2014, 02:29:06)
[GCC 4.7.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
import sys
def f(): sys.setrecursionlimit(sys.getrecursionlimit()+1) or f()
...
f()
Segmentation fault

But otherwise, yes. You shouldn't be able to segfault Python with Python code.

I would have expected an out-of-memory error. If there is not already a crash issue on the tracker for this, you could add one.


--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to