Ensure strings when setting openmc.lib.Tally.scores

In using lists of containing integer reactions as
the scores, e.g.
```
t = openmc.lib.Tally()
t.scores = [901]
```
The setter would fail as the integers do not have an
encode method. This converts all incoming scores
to strings prior to passing values to the shared library.
This commit is contained in:
Andrew Johnson 2019-09-16 15:12:42 -05:00
parent 016fc0e43e
commit ca410a82fe
No known key found for this signature in database
GPG key ID: 253418E91B7F6FEB

View file

@ -319,7 +319,7 @@ class Tally(_FortranObjectWithID):
@scores.setter
def scores(self, scores):
scores_ = (c_char_p * len(scores))()
scores_[:] = [x.encode() for x in scores]
scores_[:] = [str(x).encode() for x in scores]
_dll.openmc_tally_set_scores(self._index, len(scores), scores_)
@property