Oleg Oshmyan <chor...@inbox.lv> added the comment:

I just want to note that the code might be edited not only while it is running 
it in the interactive interpreter but also while it is running as a standalone 
script. In this case the script naturally would not know to reload its own code 
nor allow the user to do it manually, and even if it would, some objects 
created from the old code would probably remain alive.

Here is a simple shell script that causes Python to show a stack traceback with 
'# This is just a comment' as the offending line by launching it in the 
background and then overwriting the Python code. What happened in reality is 
that I launched a front-end tool for video transcoding I had written in Python 
and after a while tweaked the code while it was still running. When the actual 
encode finished, my (buggy) clean-up code raised an exception and I got a 
traceback saying it had been raised in a line that only had a comment in it.

cat <<EOF >proof.py
import time
time.sleep(5)
raise Exception
EOF
python proof.py &
sleep 1
cat <<EOF >proof.py


# This is just a comment
EOF
sleep 5

----------
nosy: +chortos

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

Reply via email to