Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it less likely that we use ValidateTrait.int_range accidentally #805

Merged
merged 1 commit into from
Jan 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions traits/trait_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1670,6 +1670,8 @@ def __init__(
self._low_name = self._high_name = ""
self._vtype = Undefined

kind = None

if vtype is float:
self._validate = "float_validate"
kind = ValidateTrait.float_range
Expand All @@ -1682,7 +1684,6 @@ def __init__(

elif vtype is int:
self._validate = "int_validate"
kind = ValidateTrait.int_range
self._type_desc = "an integer"
if low is not None:
low = int(low)
Expand Down Expand Up @@ -1720,7 +1721,7 @@ def __init__(
if exclude_high:
exclude_mask |= 2

if is_static and (vtype is not int):
if is_static and kind is not None:
self.init_fast_validate(kind, low, high, exclude_mask)

#: Assign type-corrected arguments to handler attributes:
Expand Down