Only use bytes on python >= 3.11

This commit is contained in:
Kovid Goyal 2023-10-01 15:02:51 +05:30
parent b7fd0dde65
commit 2858397017
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -107,7 +107,8 @@ def initialize_calibre():
def wrapped_orig_spawn_fds(args, passfds):
# as of python 3.11 util.spawnv_passfds expects bytes args
args = [x.encode('utf-8') if isinstance(x, str) else x for x in args]
if sys.version_info >= (3, 11):
args = [x.encode('utf-8') if isinstance(x, str) else x for x in args]
return orig_spawn_passfds(args[0], args, passfds)
def spawnv_passfds(path, args, passfds):