This repository was archived by the owner on Feb 13, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +22
-2
lines changed Expand file tree Collapse file tree 3 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -176,7 +176,7 @@ def __init__(self,
176
176
self ._root_section = self ._Section (self , None )
177
177
self ._current_section = self ._root_section
178
178
179
- self ._whitespace_matcher = _re .compile (r'\s+' )
179
+ self ._whitespace_matcher = _re .compile (r'\s+' , _re . ASCII )
180
180
self ._long_break_matcher = _re .compile (r'\n\n\n+' )
181
181
182
182
# ===============================
Original file line number Diff line number Diff line change @@ -1943,6 +1943,23 @@ def test_help_extra_prefix_chars(self):
1943
1943
++foo foo help
1944
1944
''' ))
1945
1945
1946
+ def test_help_non_breaking_spaces (self ):
1947
+ parser = ErrorRaisingArgumentParser (
1948
+ prog = 'PROG' , description = 'main description' )
1949
+ parser .add_argument (
1950
+ "--non-breaking" , action = 'store_false' ,
1951
+ help = 'help message containing non-breaking spaces shall not '
1952
+ 'wrap\N{NO-BREAK SPACE} at non-breaking spaces' )
1953
+ self .assertEqual (parser .format_help (), textwrap .dedent ('''\
1954
+ usage: PROG [-h] [--non-breaking]
1955
+
1956
+ main description
1957
+
1958
+ optional arguments:
1959
+ -h, --help show this help message and exit
1960
+ --non-breaking help message containing non-breaking spaces shall not
1961
+ wrap\N{NO-BREAK SPACE} at non-breaking spaces
1962
+ ''' ))
1946
1963
1947
1964
def test_help_alternate_prefix_chars (self ):
1948
1965
parser = self ._get_parser (prefix_chars = '+:/' )
Original file line number Diff line number Diff line change @@ -13,9 +13,12 @@ Core and Builtins
13
13
Library
14
14
-------
15
15
16
+ - Issue #29290: Fix a regression in argparse that help messages would wrap at
17
+ non-breaking spaces.
18
+
16
19
- Issue #28735: Fixed the comparison of mock.MagickMock with mock.ANY.
17
20
18
- - Issue #29011: Fix an important omission by adding Deque to the typing module.
21
+ - Issue #29011: Fix an important omission by adding Deque to the typing module.
19
22
20
23
- Issue #29219: Fixed infinite recursion in the repr of uninitialized
21
24
ctypes.CDLL instances.
You can’t perform that action at this time.
0 commit comments