mirror of
https://github.com/python/cpython.git
synced 2025-11-01 22:21:35 +00:00
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>
This commit is contained in:
parent
0a32c6959c
commit
14e5bdceff
3 changed files with 22 additions and 1 deletions
|
|
@ -1360,7 +1360,7 @@ def __init__(self,
|
|||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue