do not allow negative values in parse_num()
This commit is contained in:
parent
a2d846052e
commit
5b7f93bb9a
1 changed files with 3 additions and 0 deletions
|
@ -2083,6 +2083,9 @@ def parse_num(num, name):
|
||||||
except ValueError:
|
except ValueError:
|
||||||
msg = "%s is not a floating point number: %s" % (name, num)
|
msg = "%s is not a floating point number: %s" % (name, num)
|
||||||
raise argparse.ArgumentTypeError(msg)
|
raise argparse.ArgumentTypeError(msg)
|
||||||
|
if num < 0:
|
||||||
|
msg = "%s must not be negative: %s" % (name, num)
|
||||||
|
raise argparse.ArgumentTypeError(msg)
|
||||||
if unit == Unit.cm:
|
if unit == Unit.cm:
|
||||||
num = cm_to_pt(num)
|
num = cm_to_pt(num)
|
||||||
elif unit == Unit.mm:
|
elif unit == Unit.mm:
|
||||||
|
|
Loading…
Reference in a new issue