Work around a 2to3 bug. PYTHON-494

This commit is contained in:
A. Jesse Jiryu Davis 2013-08-14 14:07:31 -04:00
parent ba66a2dde7
commit d863ccf458

View File

@ -520,7 +520,13 @@ def decode_all(data, as_class=dict,
except Exception:
# Change exception type to InvalidBSON but preserve traceback.
exc_type, exc_value, exc_tb = sys.exc_info()
raise InvalidBSON, InvalidBSON(str(exc_value)), exc_tb
if PY3:
e = InvalidBSON(str(exc_value))
raise e.with_traceback(exc_tb)
else:
# 2to3 mistranslates this.
raise InvalidBSON, InvalidBSON(str(exc_value)), exc_tb
if _use_c:
decode_all = _cbson.decode_all