-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gh-105712: Use appropriate regex to detect negative numbers in arguments
previously, type=float values like -3e12 would be misinterpreted as -option Signed-off-by: Marcus Müller <[email protected]>
- Loading branch information
1 parent
a79a272
commit f683f09
Showing
2 changed files
with
9 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
Misc/NEWS.d/next/Library/2024-02-01-02-09-29.gh-issue-105712.rnlreu.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Fix the issue that:: | ||
|
||
parser.add_argument("-p", "--param", type=float) | ||
args = parser.parse_args() | ||
|
||
fails to correctly deal with `-p -3e12`, thinking that `-3e12` is an option, | ||
not a parameter to one. That's because the old regex was too restrictive. | ||
This fixes that with no found downsides. |