mirror of https://github.com/python/cpython
Don't die when getuid() or getpid() aren't defined.
This commit is contained in:
parent
3df7b5a546
commit
0c8cf888eb
|
@ -106,8 +106,14 @@ def choose_boundary():
|
|||
import socket
|
||||
import os
|
||||
hostid = socket.gethostbyname(socket.gethostname())
|
||||
uid = `os.getuid()`
|
||||
pid = `os.getpid()`
|
||||
try:
|
||||
uid = `os.getuid()`
|
||||
except:
|
||||
uid = '1'
|
||||
try:
|
||||
pid = `os.getpid()`
|
||||
except:
|
||||
pid = '1'
|
||||
seed = `rand.rand()`
|
||||
_prefix = hostid + '.' + uid + '.' + pid
|
||||
timestamp = `int(time.time())`
|
||||
|
|
Loading…
Reference in New Issue