10000 gh-82005: Properly handle user input warnings in IDLE shell. by terryjreedy · Pull Request #15311 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-82005: Properly handle user input warnings in IDLE shell. #15311

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
D490
Prev Previous commit
Next Next commit
Stop printing bogus prompt after warning.
  • Loading branch information
terryjreedy committed Aug 16, 2019
commit 54edc239af51d8bf9791bf894616e393c68eeeb1
8 changes: 3 additions & 5 deletions Lib/idlelib/pyshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,16 @@

def idle_showwarning(
message, category, filename, lineno, file=None, line=None):
"""Show Idle-format warning (after replacing warnings.showwarning).
"""Print Idle-format warning to warning_stream.

The differences are the formatter called, the file=None replacement,
which can be None, the capture of the consequence AttributeError,
and the output of a hard-coded prompt.
Difference from show_warning are the formatter, the file=None
replacement, and the capture of the consequence AttributeError.
"""
if file is None:
file = warning_stream
try:
file.write(idle_formatwarning(
message, category, filename, lineno, line=line))
file.write(">>> ")
except (AttributeError, OSError):
pass # if file (probably __stderr__) is invalid, skip warning.

Expand Down
0