summaryrefslogtreecommitdiffstats
path: root/Lib/argparse.py
diff options
context:
space:
mode:
authorSavannah Ostrowski <savannahostrowski@gmail.com>2024-09-17 06:30:17 (GMT)
committerGitHub <noreply@github.com>2024-09-17 06:30:17 (GMT)
commit14e5bdceff45e6e789e1f838b96988946c75b0f4 (patch)
tree8d43ae310ad4fd2bb41f7637de633937feb4aef9 /Lib/argparse.py
parent0a32c6959c265d21d7c43fe8e4aefc8c0983e85e (diff)
downloadcpython-14e5bdceff45e6e789e1f838b96988946c75b0f4.zip
cpython-14e5bdceff45e6e789e1f838b96988946c75b0f4.tar.gz
cpython-14e5bdceff45e6e789e1f838b96988946c75b0f4.tar.bz2
GH-123945: Update regex for parsing negative numbers that contain underscores (#123970)
--------- Co-authored-by: Brandt Bucher <brandtbucher@gmail.com> Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Diffstat (limited to 'Lib/argparse.py')
-rw-r--r--Lib/argparse.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/argparse.py b/Lib/argparse.py
index 100ef9f..a88a8c6 100644
--- a/Lib/argparse.py
+++ b/Lib/argparse.py
@@ -1360,7 +1360,7 @@ class _ActionsContainer(object):
self._defaults = {}
# determines whether an "option" looks like a negative number
- self._negative_number_matcher = _re.compile(r'^-\d+$|^-\d*\.\d+$')
+ self._negative_number_matcher = _re.compile(r'^-\d[\d_]*(\.\d[\d_]*)?$')
# whether or not there are any optionals that look like negative
# numbers -- uses a list so it can be shared and edited