This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Ted Meyer
Recipients Ted Meyer
Date 2016-12-28.20:38:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1482957515.7.0.441178310139.issue29096@psf.upfronthosting.co.za>
In-reply-to
Content
Using this simple snippit of code:
import signal



import signal

def sig_hdlr(signum, frame):
    raise ValueError()

def faulty():
    local_var = ""
    signal.signal(signal.SIGALRM, sig_hdlr)
    signal.alarm(1)
    try:
        while True:
            local_var += "!"
    except ValueError:
        print (local_val)

faulty()



I can reliably get a crash:
tmathmeyer@tmathmeyer-linuxstation:~$ python --version
Python 2.7.6
tmathmeyer@tmathmeyer-linuxstation:~$ python pybug.py 
Traceback (most recent call last):
  File "pybug.py", line 16, in <module>
    faulty()
  File "pybug.py", line 14, in faulty
    print local_val
NameError: global name 'local_val' is not defined

tmathmeyer@tmathmeyer-linuxstation:~$ python3.4 pybug.py 
Traceback (most recent call last):
  File "pybug.py", line 12, in faulty
    local_var += "!"
  File "pybug.py", line 4, in sig_hdlr
    raise ValueError()
ValueError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "pybug.py", line 16, in <module>
    faulty()
  File "pybug.py", line 14, in faulty
    print (local_val)
NameError: name 'local_val' is not defined


I can repro this on 2.7.6 and 3.4, but do not have other versions to test on.
History
Date User Action Args
2016-12-28 20:38:35Ted Meyersetrecipients: + Ted Meyer
2016-12-28 20:38:35Ted Meyersetmessageid: <1482957515.7.0.441178310139.issue29096@psf.upfronthosting.co.za>
2016-12-28 20:38:35Ted Meyerlinkissue29096 messages
2016-12-28 20:38:35Ted Meyercreate