More robust way of choosing a non-existant uid (faster, too).

This commit is contained in:
Guido van Rossum 1997-05-20 19:31:25 +00:00
parent 037b2205e8
commit 6308d510e9
1 changed files with 4 additions and 4 deletions

View File

@ -59,10 +59,10 @@ except KeyError:
else: else:
print 'fakename', fakename, 'did not except pwd.getpwnam()' print 'fakename', fakename, 'did not except pwd.getpwnam()'
uids = byuids.keys() # Choose a non-existant uid.
uids.sort() fakeuid = 4127
uids.reverse() while byuids.has_key(fakeuid):
fakeuid = uids[0] + 1 print 'fakeuid =', fakeuid
try: try:
pwd.getpwuid(fakeuid) pwd.getpwuid(fakeuid)