New submission from Pierre Ossman <oss...@cendio.se>:

sudo breaks exception handling in Python in some subtle way. The following test 
program works fine when run directly, but breaks when run through sudo:


#!/usr/bin/python

import time

def a():
        try:
                while True:
                        time.sleep(0.001)
        except KeyboardInterrupt:
                print "a"

def b():
        try:
                a()
        except KeyboardInterrupt:
                print "b"

b()


This is expected:

pierre@pangolin:~$ ./test.py
^Ca

But through sudo you get random behaviour:

pierre@pangolin:~$ sudo ./test.py
^Ca b
pierre@pangolin:~$ sudo ./test.py
^Ca b
pierre@pangolin:~$ sudo ./test.py
^Ca
b
pierre@pangolin:~$ sudo ./test.py
^Ca
pierre@pangolin:~$ sudo ./test.py
^Ca
pierre@pangolin:~$ sudo ./test.py
^Cb


Seen on Ubuntu 12.04 (alpha/beta) and on Fedora 16. Happens more often on 
Ubuntu though.

----------
components: Interpreter Core
messages: 157358
nosy: ossman
priority: normal
severity: normal
status: open
title: sudo breaks python
versions: Python 2.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue14476>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to