Commit 5ed8f324 authored by Martin Reinecke's avatar Martin Reinecke
Browse files

disallow implicit conversion of Field to boolean

parent 1e05a9ee
Pipeline #29345 passed with stages
in 12 minutes and 22 seconds
...@@ -79,6 +79,13 @@ class Field(object): ...@@ -79,6 +79,13 @@ class Field(object):
if locked: if locked:
dobj.lock(self._val) dobj.lock(self._val)
# prevent implicit conversion to bool
def __nonzero__(self):
raise TypeError("Field does not support implicit conversion to bool")
def __bool__(self):
raise TypeError("Field does not support implicit conversion to bool")
@staticmethod @staticmethod
def full(domain, val, dtype=None): def full(domain, val, dtype=None):
"""Creates a Field with a given domain, filled with a constant value. """Creates a Field with a given domain, filled with a constant value.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment