Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1039f39

Browse files
authored
bpo-37824: Properly handle user input warnings in IDLE shell. (GH-15500)
Cease turning SyntaxWarnings into SyntaxErrors.
1 parent73e0549 commit1039f39

File tree

3 files changed

+11
-14
lines changed

3 files changed

+11
-14
lines changed

‎Lib/idlelib/NEWS.txt‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ Released on 2019-10-20?
33
======================================
44

55

6+
bpo-37824: Properly handle user input warnings in IDLE shell.
7+
Cease turning SyntaxWarnings into SyntaxErrors.
8+
9+
bpo-37929: IDLE Settings dialog now closes properly when there is no
10+
shell window.
11+
612
bpo-37849: Fix completions list appearing too high or low when shown
713
above the current line.
814

‎Lib/idlelib/pyshell.py‎

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,6 @@ def __init__(self, tkconsole):
394394
self.tkconsole=tkconsole
395395
locals=sys.modules['__main__'].__dict__
396396
InteractiveInterpreter.__init__(self,locals=locals)
397-
self.save_warnings_filters=None
398397
self.restarting=False
399398
self.subprocess_arglist=None
400399
self.port=PORT
@@ -665,8 +664,6 @@ def runsource(self, source):
665664
"Extend base class method: Stuff the source in the line cache first"
666665
filename=self.stuffsource(source)
667666
self.more=0
668-
self.save_warnings_filters=warnings.filters[:]
669-
warnings.filterwarnings(action="error",category=SyntaxWarning)
670667
# at the moment, InteractiveInterpreter expects str
671668
assertisinstance(source,str)
672669
#if isinstance(source, str):
@@ -677,14 +674,9 @@ def runsource(self, source):
677674
# self.tkconsole.resetoutput()
678675
# self.write("Unsupported characters in input\n")
679676
# return
680-
try:
681-
# InteractiveInterpreter.runsource() calls its runcode() method,
682-
# which is overridden (see below)
683-
returnInteractiveInterpreter.runsource(self,source,filename)
684-
finally:
685-
ifself.save_warnings_filtersisnotNone:
686-
warnings.filters[:]=self.save_warnings_filters
687-
self.save_warnings_filters=None
677+
# InteractiveInterpreter.runsource() calls its runcode() method,
678+
# which is overridden (see below)
679+
returnInteractiveInterpreter.runsource(self,source,filename)
688680

689681
defstuffsource(self,source):
690682
"Stuff source in the filename cache"
@@ -763,9 +755,6 @@ def runcode(self, code):
763755
ifself.tkconsole.executing:
764756
self.interp.restart_subprocess()
765757
self.checklinecache()
766-
ifself.save_warnings_filtersisnotNone:
767-
warnings.filters[:]=self.save_warnings_filters
768-
self.save_warnings_filters=None
769758
debugger=self.debugger
770759
try:
771760
self.tkconsole.beginexecuting()
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Properly handle user input warnings in IDLE shell. Cease turning
2+
SyntaxWarnings into SyntaxErrors.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp