From b405ecd508910d7f35777450757518a02ef4fa98 Mon Sep 17 00:00:00 2001 From: "Robert C. Buchanan" Date: Mon, 11 Mar 2024 10:30:06 -0500 Subject: [PATCH] Most minimial change to Enumerated.is_valid which will throw exception when value is invalid --- py34/bacpypes/primitivedata.py | 1 + 1 file changed, 1 insertion(+) diff --git a/py34/bacpypes/primitivedata.py b/py34/bacpypes/primitivedata.py index 57f842e..c1c5c9a 100755 --- a/py34/bacpypes/primitivedata.py +++ b/py34/bacpypes/primitivedata.py @@ -1255,6 +1255,7 @@ class Enumerated(Atomic): """Return True if arg is valid value for the class. If the string value is wrong for the enumeration, the encoding will fail. """ + cls(arg) return (isinstance(arg, int) and (arg >= 0)) or \ isinstance(arg, str)