def _set_argv(process_name):
 if (Py_GetArgcArgv is None):
  return
 global _PROCESS_NAME
 current_name = get_process_name()
 (argv, argc) = (ctypes.c_int(0), argc_t())
 Py_GetArgcArgv(argv, ctypes.pointer(argc))
 if (len(process_name) > _MAX_NAME_LENGTH):
  raise IOError("Can't rename process to something longer than our initial name (this would overwrite memory used for the env)")
 zero_size = max(len(current_name), len(process_name))
 ctypes.memset(argc.contents, 0, (zero_size + 1))
 process_name_encoded = process_name.encode('utf8')
 ctypes.memmove(argc.contents, process_name_encoded, len(process_name))
 _PROCESS_NAME = process_name

def _set_argv ( process_name ) : if ( Py_GetArgcArgv is None ) : return global _PROCESS_NAME current_name = get_process_name ( ) ( argv , argc ) = ( ctypes . c_int ( 0 ) , argc_t ( ) ) Py_GetArgcArgv ( argv , ctypes . pointer ( argc ) ) if ( len ( process_name ) > _MAX_NAME_LENGTH ) : raise IOError ( "Can't rename process to something longer than our initial name (this would overwrite memory used for the env)" ) zero_size = max ( len ( current_name ) , len ( process_name ) ) ctypes . memset ( argc . contents , 0 , ( zero_size + 1 ) ) process_name_encoded = process_name . encode ( 'utf8' ) ctypes . memmove ( argc . contents , process_name_encoded , len ( process_name ) ) _PROCESS_NAME = process_name
overwrites our argv in a similar fashion to how its done in c with: strcpy; .