Issue #29290: Merge 3.6.

This commit is contained in:
Xiang Zhang 2017-01-22 14:41:42 +08:00
commit d528791096
3 changed files with 21 additions and 1 deletions

View File

@ -182,7 +182,7 @@ class HelpFormatter(object):
self._root_section = self._Section(self, None) self._root_section = self._Section(self, None)
self._current_section = self._root_section self._current_section = self._root_section
self._whitespace_matcher = _re.compile(r'\s+') self._whitespace_matcher = _re.compile(r'\s+', _re.ASCII)
self._long_break_matcher = _re.compile(r'\n\n\n+') self._long_break_matcher = _re.compile(r'\n\n\n+')
# =============================== # ===============================

View File

@ -1943,6 +1943,23 @@ class TestAddSubparsers(TestCase):
++foo foo help ++foo foo help
''')) '''))
def test_help_non_breaking_spaces(self):
parser = ErrorRaisingArgumentParser(
prog='PROG', description='main description')
parser.add_argument(
"--non-breaking", action='store_false',
help='help message containing non-breaking spaces shall not '
'wrap\N{NO-BREAK SPACE}at non-breaking spaces')
self.assertEqual(parser.format_help(), textwrap.dedent('''\
usage: PROG [-h] [--non-breaking]
main description
optional arguments:
-h, --help show this help message and exit
--non-breaking help message containing non-breaking spaces shall not
wrap\N{NO-BREAK SPACE}at non-breaking spaces
'''))
def test_help_alternate_prefix_chars(self): def test_help_alternate_prefix_chars(self):
parser = self._get_parser(prefix_chars='+:/') parser = self._get_parser(prefix_chars='+:/')

View File

@ -215,6 +215,9 @@ Core and Builtins
Library Library
------- -------
- Issue #29290: Fix a regression in argparse that help messages would wrap at
non-breaking spaces.
- Issue #28735: Fixed the comparison of mock.MagickMock with mock.ANY. - Issue #28735: Fixed the comparison of mock.MagickMock with mock.ANY.
- Issue #29197: Removed deprecated function ntpath.splitunc(). - Issue #29197: Removed deprecated function ntpath.splitunc().