Skip to content

Commit

Permalink
Fix weird namespace behavior incompatibilities between Py2 and Py3.
Browse files Browse the repository at this point in the history
  • Loading branch information
alga committed Mar 8, 2013
1 parent ae387e6 commit 114dd15
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/ZEO/StorageServer.py
Expand Up @@ -602,7 +602,8 @@ def _delete(self, oid, serial):
self.storage.deleteObject(oid, serial, self.transaction)
except (SystemExit, KeyboardInterrupt):
raise
except Exception as err:
except Exception as e:
err = e
self._op_error(oid, err, 'delete')

return err is None
Expand All @@ -614,7 +615,8 @@ def _checkread(self, oid, serial):
oid, serial, self.transaction)
except (SystemExit, KeyboardInterrupt):
raise
except Exception as err:
except Exception as e:
err = e
self._op_error(oid, err, 'checkCurrentSerialInTransaction')

return err is None
Expand Down Expand Up @@ -669,7 +671,8 @@ def _undo(self, trans_id):
tid, oids = self.storage.undo(trans_id, self.transaction)
except (SystemExit, KeyboardInterrupt):
raise
except Exception as err:
except Exception as e:
err = e
self._op_error(z64, err, 'undo')
else:
self.invalidated.extend(oids)
Expand All @@ -681,12 +684,12 @@ def _marshal_error(self, error):
# Try to pickle the exception. If it can't be pickled,
# the RPC response would fail, so use something that can be pickled.
if PY3:
pickler = Pickler(BytesIO(), 1)
pickler = Pickler(BytesIO(), 3)
else:
pickler = Pickler()
pickler.fast = 1
try:
pickler.dump(error, 1)
pickler.dump(error)
except:
msg = "Couldn't pickle storage exception: %s" % repr(error)
self.log(msg, logging.ERROR)
Expand Down

0 comments on commit 114dd15

Please sign in to comment.