Skip to content

Commit 76cd0c3

Browse files
authored
bpo-33000: Document that IDLE's shell has no line limit. (python#10373)
A program that runs indefinitely can overfill memory.
1 parent 9fc57a3 commit 76cd0c3

File tree

3 files changed

+27
-10
lines changed

3 files changed

+27
-10
lines changed

Doc/library/idle.rst

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -671,15 +671,23 @@ When a program outputs text, the result is determined by the
671671
corresponding output device. When IDLE executes user code, ``sys.stdout``
672672
and ``sys.stderr`` are connected to the display area of IDLE's Shell. Some of
673673
its features are inherited from the underlying Tk Text widget. Others
674-
are programmed additions.
674+
are programmed additions. Where it matters, Shell is designed for development
675+
rather than production runs.
676+
677+
For instance, Shell never throws away output. A program that sends unlimited
678+
output to Shell will eventually fill memory, resulting in a memory error.
679+
In contrast, some system text windows only keep the last n lines of output.
680+
A Windows console, for instance, keeps a user-settable 1 to 9999 lines,
681+
with 300 the default.
675682

676683
Text widgets display a subset of Unicode, the Basic Multilingual Plane (BMP).
677684
Which characters get a proper glyph instead of a replacement box depends on
678685
the operating system and installed fonts. Newline characters cause following
679-
text to appear on a new line, but other control characters are replaced
680-
with a box. But note that the ``repr()`` function, which is used for
681-
interactive echo of expression values, replaces control characters
682-
with escape codes before they are output.
686+
text to appear on a new line, but other control characters are either
687+
replaced with a box or deleted. However, ``repr()``, which is used for
688+
interactive echo of expression values, replaces control characters,
689+
some BMP codepoints, and all non-BMP characters with escape codes
690+
before they are output.
683691

684692
Normal and error output are generally kept separate (on separate lines)
685693
from code input and each other. They each get different highlight colors.

Lib/idlelib/help.html

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -648,14 +648,21 @@ <h3>User output in Shell<a class="headerlink" href="#user-output-in-shell" title
648648
corresponding output device. When IDLE executes user code, <code class="docutils literal notranslate"><span class="pre">sys.stdout</span></code>
649649
and <code class="docutils literal notranslate"><span class="pre">sys.stderr</span></code> are connected to the display area of IDLE’s Shell. Some of
650650
its features are inherited from the underlying Tk Text widget. Others
651-
are programmed additions.</p>
651+
are programmed additions. Where it matters, Shell is designed for development
652+
rather than production runs.</p>
653+
<p>For instance, Shell never throws away output. A program that sends unlimited
654+
output to Shell will eventually fill memory, resulting in a memory error.
655+
In contrast, some system text windows only keep the last n lines of output.
656+
A Windows console, for instance, keeps a user-settable 1 to 9999 lines,
657+
with 300 the default.</p>
652658
<p>Text widgets display a subset of Unicode, the Basic Multilingual Plane (BMP).
653659
Which characters get a proper glyph instead of a replacement box depends on
654660
the operating system and installed fonts. Newline characters cause following
655-
text to appear on a new line, but other control characters are replaced
656-
with a box. But note that the <code class="docutils literal notranslate"><span class="pre">repr()</span></code> function, which is used for
657-
interactive echo of expression values, replaces control characters
658-
with escape codes before they are output.</p>
661+
text to appear on a new line, but other control characters are either
662+
replaced with a box or deleted. However, <code class="docutils literal notranslate"><span class="pre">repr()</span></code>, which is used for
663+
interactive echo of expression values, replaces control characters,
664+
some BMP codepoints, and all non-BMP characters with escape codes
665+
before they are output.</p>
659666
<p>Normal and error output are generally kept separate (on separate lines)
660667
from code input and each other. They each get different highlight colors.</p>
661668
<p>For SyntaxError tracebacks, the normal ‘^’ marking where the error was
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Document that IDLE's shell has no line limit. A program that runs
2+
indefinitely can overfill memory.

0 commit comments

Comments
 (0)