diff -r 9f7d16266928 Lib/argparse.py --- a/Lib/argparse.py Tue Jan 17 03:46:13 2017 +0100 +++ b/Lib/argparse.py Tue Jan 17 14:06:04 2017 +0800 @@ -182,7 +182,7 @@ self._root_section = self._Section(self, None) self._current_section = self._root_section - self._whitespace_matcher = _re.compile(r'\s+') + self._whitespace_matcher = _re.compile(r'[ \t\n\r\f\v]+') self._long_break_matcher = _re.compile(r'\n\n\n+') # =============================== diff -r 9f7d16266928 Lib/test/test_argparse.py --- a/Lib/test/test_argparse.py Tue Jan 17 03:46:13 2017 +0100 +++ b/Lib/test/test_argparse.py Tue Jan 17 14:06:04 2017 +0800 @@ -1943,6 +1943,23 @@ ++foo foo help ''')) + def test_help_non_breaking_spaces(self): + parser = ErrorRaisingArgumentParser( + prog='PROG', description='main description') + parser.add_argument( + "--no-condensedxxxx", action='store_false', + help='Disable default font-style: condensed. ' + 'Also disables "M+\N{NO-BREAK SPACE}1M" condensed monospace.') + self.assertEqual(parser.format_help(), textwrap.dedent('''\ + usage: PROG [-h] [--no-condensedxxxx] + + main description + + optional arguments: + -h, --help show this help message and exit + --no-condensedxxxx Disable default font-style: condensed. Also disables + "M+ 1M" condensed monospace. + ''')) def test_help_alternate_prefix_chars(self): parser = self._get_parser(prefix_chars='+:/')