Commit 3bfaa547 authored by Christian Theune's avatar Christian Theune

Fix for bug #184054: MappingStorage used to raise a KeyError during `load`

instead of a POSKeyError.
parent 10e35640
...@@ -37,6 +37,9 @@ New Features ...@@ -37,6 +37,9 @@ New Features
Bugs Fixed Bugs Fixed
---------- ----------
- Fix for bug #184054: MappingStorage used to raise a KeyError during `load`
instead of a POSKeyError.
- Fixed bug in Connection.TmpStore: load() would not defer to the backend - Fixed bug in Connection.TmpStore: load() would not defer to the backend
storage for loading blobs. storage for loading blobs.
......
...@@ -57,9 +57,12 @@ class MappingStorage(BaseStorage): ...@@ -57,9 +57,12 @@ class MappingStorage(BaseStorage):
def load(self, oid, version): def load(self, oid, version):
self._lock_acquire() self._lock_acquire()
try:
try: try:
p = self._index[oid] p = self._index[oid]
return p[8:], p[:8] # pickle, serial return p[8:], p[:8] # pickle, serial
except KeyError:
raise POSException.POSKeyError(oid)
finally: finally:
self._lock_release() self._lock_release()
......
...@@ -209,12 +209,12 @@ class UserMethodTests(unittest.TestCase): ...@@ -209,12 +209,12 @@ class UserMethodTests(unittest.TestCase):
>>> obj._p_state >>> obj._p_state
0 0
A request for an object that doesn't exist will raise a KeyError. A request for an object that doesn't exist will raise a POSKeyError.
>>> cn.get(p64(1)) >>> cn.get(p64(1))
Traceback (most recent call last): Traceback (most recent call last):
... ...
KeyError: '\x00\x00\x00\x00\x00\x00\x00\x01' POSKeyError: 0x01
""" """
def test_close(self): def test_close(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment