mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
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:
parent
016fc0e43e
commit
ca410a82fe
1 changed files with 1 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue