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.

classification
Title: IDLE: Freezes and/or crash on SyntaxWarning... is used prior to global declaration
Type: Stage: resolved
Components: IDLE Versions: Python 2.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: IDLE problem displaying warning message
View: 12438
Assigned To: Nosy List: marco, ned.deily, roger.serwy
Priority: normal Keywords:

Created on 2011-12-23 01:23 by marco, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue_global_crash.py marco, 2011-12-23 01:23
Messages (3)
msg150125 - (view) Author: Marco Scataglini (marco) Date: 2011-12-23 01:23
Writing the following code in the IDLE module/scriptneditor and then running it (F5) will momentarily freeze without giving the expected warning message ("SyntaxWarning: name 'GLOBAL1' is used prior to global declaration") and it will crash all IDLE windows instances if ran multiple times after it.

------------------
start code snippet:
------------------
GLOBAL1=10

def test_chnge_val_1(a=1):
##    global GLOBAL1
    b=GLOBAL1
    print GLOBAL1, b
    global GLOBAL1
    GLOBAL1 += a
    b= 100
    print GLOBAL1, b
 

if __name__ == '__main__':
    test_chnge_val_1()
----------------
end code snippet:
----------------

The desired behavior is to not crash but run the code with output and shoot the expected message to STOUT/shell console like regular python shell would.


-----
Notes:
-----
issue_global_crash.py code-file attached.
msg150132 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2011-12-23 03:15
I ran IDLE with a console and then ran your script against the latest release. The error message is due to a bug in idle_showwarning. 

Your script works with the development version, however. This is a duplicate of issue12438 which was fixed in e9c406a53972, but not yet released.
msg150134 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2011-12-23 07:04
The fix has been released in Python 3.2.2.  It will be in Python 2.7.3 when released.
History
Date User Action Args
2022-04-11 14:57:25adminsetgithub: 57863
2011-12-23 07:04:20ned.deilysetstatus: open -> closed

superseder: IDLE problem displaying warning message

nosy: + ned.deily
messages: + msg150134
resolution: duplicate
stage: resolved
2011-12-23 03:15:34roger.serwysetnosy: + roger.serwy
messages: + msg150132
2011-12-23 01:23:32marcocreate