From dbd447a27ab80c321016380575f57bdfbd10014b Mon Sep 17 00:00:00 2001 From: "David P. Chassin" Date: Sun, 1 Oct 2023 12:23:29 -0700 Subject: [PATCH] Fix fast accessor autotest (#98) Signed-off-by: David P. Chassin Signed-off-by: David P. Chassin --- python/autotest/test_fast_accessor.glm | 13 ++++++------- python/autotest/test_fast_accessor.py | 5 ++--- python/python.cpp | 6 +++--- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/python/autotest/test_fast_accessor.glm b/python/autotest/test_fast_accessor.glm index 4240f80c9..e292e7903 100644 --- a/python/autotest/test_fast_accessor.glm +++ b/python/autotest/test_fast_accessor.glm @@ -45,11 +45,10 @@ object test value 6; relation "=="; }; -// removed due to problem with set_bool() -// object assert -// { -// target b; -// value TRUE; -// relation "=="; -// }; + object assert + { + target b; + value TRUE; + relation "=="; + }; } diff --git a/python/autotest/test_fast_accessor.py b/python/autotest/test_fast_accessor.py index 63302d7dc..56cd22896 100644 --- a/python/autotest/test_fast_accessor.py +++ b/python/autotest/test_fast_accessor.py @@ -16,8 +16,7 @@ def test_init(obj,t): k = gridlabd.get_property(obj,"k") gridlabd.set_int16(k,gridlabd.get_int16(k)+6) - # TODO: this fails on linux because PyArg_ParseArgs("K") doesn't work if followed by "p" - # b = gridlabd.get_property(obj,"b") - # gridlabd.set_bool(b,True) + b = gridlabd.get_property(obj,"b") + gridlabd.set_bool(b,True) return 0 diff --git a/python/python.cpp b/python/python.cpp index 41272cc77..c0a9fc321 100644 --- a/python/python.cpp +++ b/python/python.cpp @@ -1672,14 +1672,14 @@ static PyObject *gridlabd_set_int16(PyObject *self, PyObject *args) static PyObject *gridlabd_set_bool(PyObject *self, PyObject *args) { - bool *addr; - bool value; + int *addr; + int value; restore_environ(); if ( ! PyArg_ParseTuple(args, "Kp", &addr, &value) ) { return NULL; } - bool old = *addr; + int old = *addr; *addr = value; if ( old ) Py_RETURN_TRUE;