Skip to content

Commit

Permalink
Fix fast accessor autotest (#98)
Browse files Browse the repository at this point in the history
Signed-off-by: David P. Chassin <dchassin@slac.stanford.edu>
Signed-off-by: David P. Chassin <david.chassin@me.com>
  • Loading branch information
David P. Chassin authored and dchassin committed Oct 16, 2023
1 parent 09e563d commit dbd447a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
13 changes: 6 additions & 7 deletions python/autotest/test_fast_accessor.glm
Original file line number Diff line number Diff line change
Expand Up @@ -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 "==";
};
}
5 changes: 2 additions & 3 deletions python/autotest/test_fast_accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions python/python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit dbd447a

Please sign in to comment.