mirror of
https://github.com/xcat2/confluent.git
synced 2025-07-11 15:21:31 +00:00
Fix python3 ctypes str usage
In python3, the string is likely to be unicode and incompatible with the libc function. If it isn't bytes, force it to be bytes.
This commit is contained in:
@ -18,6 +18,8 @@ def getgrouplist(name, gid, ng=32):
|
||||
_getgrouplist.argtypes = [c_char_p, c_uint, POINTER(c_uint * ng), POINTER(c_int)]
|
||||
glist = (c_uint * ng)()
|
||||
nglist = c_int(ng)
|
||||
if not isinstance(name, bytes):
|
||||
name = name.encode('utf-8')
|
||||
count = _getgrouplist(name, gid, byref(glist), byref(nglist))
|
||||
if count < 0:
|
||||
raise TooSmallException(nglist.value)
|
||||
|
Reference in New Issue
Block a user