setenv return int

This commit is contained in:
Concedo
2026-05-03 13:32:05 +08:00
parent 2fb97d9c2c
commit 9be810628e
2 changed files with 6 additions and 3 deletions
+4 -3
View File
@@ -403,12 +403,13 @@ extern "C"
return gpttype_clear_state_kv(true);
}
void set_environment_variable(const char * identifier, const char * value)
int set_environment_variable(const char * identifier, const char * value)
{
if (!identifier || !value) return -1;
#ifdef _WIN32
_putenv_s(identifier, value);
return _putenv_s(identifier, value);
#else
setenv(identifier, value, 1);
return setenv(identifier, value, 1);
#endif
}
}
+2
View File
@@ -949,6 +949,8 @@ def init_library():
handle.last_logprobs.restype = last_logprobs_outputs
handle.detokenize.argtypes = [token_count_outputs]
handle.detokenize.restype = ctypes.c_char_p
handle.set_environment_variable.restype = ctypes.c_int
handle.set_environment_variable.argtypes = [ctypes.c_char_p, ctypes.c_char_p]
def set_backend_props(inputs):
# we must force an explicit tensor split