Show Idle-format warning (after replacing warnings.showwarning). 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.
(
message, category, filename, lineno, file=None, line=None)
| 64 | warning_stream = sys.__stderr__ # None, at least on Windows, if no console. |
| 65 | |
| 66 | def idle_showwarning( |
| 67 | message, category, filename, lineno, file=None, line=None): |
| 68 | """Show Idle-format warning (after replacing warnings.showwarning). |
| 69 | |
| 70 | The differences are the formatter called, the file=None replacement, |
| 71 | which can be None, the capture of the consequence AttributeError, |
| 72 | and the output of a hard-coded prompt. |
| 73 | """ |
| 74 | if file is None: |
| 75 | file = warning_stream |
| 76 | try: |
| 77 | file.write(idle_formatwarning( |
| 78 | message, category, filename, lineno, line=line)) |
| 79 | file.write(">>> ") |
| 80 | except (AttributeError, OSError): |
| 81 | pass # if file (probably __stderr__) is invalid, skip warning. |
| 82 | |
| 83 | _warnings_showwarning = None |
| 84 |
nothing calls this directly
no test coverage detected
searching dependent graphs…