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 +21
-1
lines changed Expand file tree Collapse file tree 3 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -182,7 +182,7 @@ def __init__(self,
182
182
self ._root_section = self ._Section (self , None )
183
183
self ._current_section = self ._root_section
184
184
185
- self ._whitespace_matcher = _re .compile (r'\s+' )
185
+ self ._whitespace_matcher = _re .compile (r'\s+' , _re . ASCII )
186
186
self ._long_break_matcher = _re .compile (r'\n\n\n+' )
187
187
188
188
# ===============================
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 @@ -47,6 +47,9 @@ Core and Builtins
47
47
Library
48
48
-------
49
49
50
+ - Issue #29290: Fix a regression in argparse that help messages would wrap at
51
+ non-breaking spaces.
52
+
50
53
- Issue #28735: Fixed the comparison of mock.MagickMock with mock.ANY.
51
54
52
55
- Issue #29316: Restore the provisional status of typing module, add
You can’t perform that action at this time.
0 commit comments