diff options
author | Gregory P. Smith <greg@mad-scientist.com> | 2007-11-01 21:55:08 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@mad-scientist.com> | 2007-11-01 21:55:08 (GMT) |
commit | 568065e9d152ed495775a767968a8749fe78a75c (patch) | |
tree | 1df5f9cc6364ed2f4183c65cd3197e2e30fce5dc /Lib/bsddb/dbtables.py | |
parent | 48decfe7403bc1dda386cc469b28236c8de018d2 (diff) | |
download | cpython-568065e9d152ed495775a767968a8749fe78a75c.zip cpython-568065e9d152ed495775a767968a8749fe78a75c.tar.gz cpython-568065e9d152ed495775a767968a8749fe78a75c.tar.bz2 |
Fixes issue1371 and reenables those tests.
Merge r58757 and r58758 from trunk.
Undoes incorrect dbtables fix and errant strdup introduced as
described below:
r58757 | gregory.p.smith | 2007-11-01 14:08:14 -0700 (Thu, 01 Nov 2007) | 4 lines
Fix bug introduced in revision 58385. Database keys could no longer
have NULL bytes in them. Replace the errant strdup with a
malloc+memcpy. Adds a unit test for the correct behavior.
r58758 | gregory.p.smith | 2007-11-01 14:15:36 -0700 (Thu, 01 Nov 2007) | 3 lines
Undo revision 58533 58534 fixes. Those were a workaround for
a problem introduced by 58385.
Diffstat (limited to 'Lib/bsddb/dbtables.py')
-rw-r--r-- | Lib/bsddb/dbtables.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Lib/bsddb/dbtables.py b/Lib/bsddb/dbtables.py index 85a13ff..06fcf8a 100644 --- a/Lib/bsddb/dbtables.py +++ b/Lib/bsddb/dbtables.py @@ -362,12 +362,11 @@ class bsdTableDB : unique = 0 while not unique: # Generate a random 64-bit row ID string - # (note: this code has <64 bits of randomness + # (note: might have <64 bits of randomness # but it's plenty for our database id needs!) - # We must ensure that no null bytes are in the id value. blist = [] for x in range(_rowid_str_len): - blist.append(random.randint(1,255)) + blist.append(random.randint(0,255)) newid = bytes(blist) # Guarantee uniqueness by adding this key to the database |