Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1601)

Unified Diff: Lib/argparse.py

Issue 13041: argparse: terminal width is not detected properly
Patch Set: Created 1 year, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Lib/test/test_argparse.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Lib/argparse.py
+++ b/Lib/argparse.py
@@ -89,6 +89,7 @@
import re as _re
import sys as _sys
import textwrap as _textwrap
+import shutil as _shutil
from gettext import gettext as _, ngettext
@@ -156,10 +157,7 @@
# default setting for width
if width is None:
- try:
- width = int(_os.environ['COLUMNS'])
- except (KeyError, ValueError):
- width = 80
+ width = _shutil.get_terminal_size().columns
width -= 2
self._prog = prog
« no previous file with comments | « no previous file | Lib/test/test_argparse.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld cbc36f91f3f7