-
-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disallow NaN values when float parsing
- Loading branch information
Showing
3 changed files
with
15 additions
and
3 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
# Copyright (C) 2016-2021 Kevin O'Connor <[email protected]> | ||
# | ||
# This file may be distributed under the terms of the GNU GPLv3 license. | ||
import sys, os, glob, re, time, logging, configparser, io | ||
import sys, os, glob, re, time, logging, configparser, io, mathutil | ||
from extras.danger_options import get_danger_options | ||
|
||
error = configparser.Error | ||
|
@@ -49,6 +49,8 @@ def _get_wrapper( | |
"Option '%s' in section '%s' must be specified" | ||
% (option, self.section) | ||
) | ||
if parser is float: | ||
parser = mathutil.safe_float | ||
try: | ||
v = parser(self.section, option) | ||
except self.error as e: | ||
|
@@ -209,7 +211,7 @@ def getfloatlist( | |
default, | ||
seps=(sep,), | ||
count=count, | ||
parser=float, | ||
parser=mathutil.safe_float, | ||
note_valid=note_valid, | ||
) | ||
|
||
|
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
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