mirror of https://github.com/python/cpython.git
__setitem__: Use integer division for computing # of blocks.
This commit is contained in:
parent
663d1b61cb
commit
ef6573e529
|
@ -114,8 +114,8 @@ def __setitem__(self, key, val):
|
||||||
self._addkey(key, (pos, siz))
|
self._addkey(key, (pos, siz))
|
||||||
else:
|
else:
|
||||||
pos, siz = self._index[key]
|
pos, siz = self._index[key]
|
||||||
oldblocks = (siz + _BLOCKSIZE - 1) / _BLOCKSIZE
|
oldblocks = (siz + _BLOCKSIZE - 1) // _BLOCKSIZE
|
||||||
newblocks = (len(val) + _BLOCKSIZE - 1) / _BLOCKSIZE
|
newblocks = (len(val) + _BLOCKSIZE - 1) // _BLOCKSIZE
|
||||||
if newblocks <= oldblocks:
|
if newblocks <= oldblocks:
|
||||||
pos, siz = self._setval(pos, val)
|
pos, siz = self._setval(pos, val)
|
||||||
self._index[key] = pos, siz
|
self._index[key] = pos, siz
|
||||||
|
|
Loading…
Reference in New Issue