Skip to content

Commit

Permalink
Improve string handling in ElementId construction.
Browse files Browse the repository at this point in the history
Co-authored-by: Pierre Gergondet <[email protected]>
  • Loading branch information
mmurooka and gergondet authored Aug 15, 2023
1 parent 46ea4d0 commit 657fe7c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion binding/python/mc_control/mc_control.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,9 @@ cdef class MCGlobalController(object):

cdef class ElementId(object):
def __cinit__(self, category, name):
self.impl = c_mc_control.ElementId(category, name)
if isinstance(name, unicode):
name = name.encode(u'ascii')
self.impl = c_mc_control.ElementId([s.encode(u'ascii') if isinstance(s, unicode) else s for s in category] , name)
property category:
def __get__(self):
return self.impl.category
Expand Down

0 comments on commit 657fe7c

Please sign in to comment.