Merge "py3: Use six.reraise() to reraise an exception"

This commit is contained in:
Jenkins 2015-10-12 19:45:15 +00:00 committed by Gerrit Code Review
commit 770780e6e3
5 changed files with 9 additions and 7 deletions

View File

@ -333,7 +333,7 @@ class DatabaseBroker(object):
elif 'disk I/O error' in str(exc_value):
exc_hint = 'disk error while accessing'
else:
raise exc_type, exc_value, exc_traceback
six.reraise(exc_type, exc_value, exc_traceback)
prefix_path = os.path.dirname(self.db_dir)
partition_path = os.path.dirname(prefix_path)
dbs_path = os.path.dirname(partition_path)

View File

@ -16,6 +16,7 @@
from eventlet import sleep, Timeout
from eventlet.green import httplib, socket, urllib2
import json
import six
from six.moves import range
from six.moves import urllib
import struct
@ -194,7 +195,7 @@ class InternalClient(object):
_('Unexpected response: %s') % resp.status, resp)
if exc_type:
# To make pep8 tool happy, in place of raise t, v, tb:
raise exc_type(*exc_value.args), None, exc_traceback
six.reraise(exc_type(*exc_value.args), None, exc_traceback)
def _get_metadata(
self, path, metadata_prefix='', acceptable_statuses=(2,),

View File

@ -74,6 +74,7 @@ bandwidth usage will want to only sum up logs with no swift.source.
import sys
import time
import six
from six.moves.urllib.parse import quote, unquote
from swift.common.swob import Request
from swift.common.utils import (get_logger, get_remote_client,
@ -342,7 +343,7 @@ class ProxyLoggingMiddleware(object):
self.log_request(
req, status_int, input_proxy.bytes_received, 0, start_time,
time.time())
raise exc_type, exc_value, exc_traceback
six.reraise(exc_type, exc_value, exc_traceback)
else:
return iter_response(iterable)

View File

@ -350,7 +350,7 @@ class SegmentedIterable(object):
(self.name, self.max_get_time))
if pending_req:
yield pending_req, pending_etag, pending_size
raise e_type, e_value, e_traceback
six.reraise(e_type, e_value, e_traceback)
if time.time() - start_time > self.max_get_time:
raise SegmentError(

View File

@ -831,11 +831,11 @@ class ResumingGetter(object):
except ChunkReadTimeout:
exc_type, exc_value, exc_traceback = exc_info()
if self.newest or self.server_type != 'Object':
raise exc_type, exc_value, exc_traceback
six.reraise(exc_type, exc_value, exc_traceback)
try:
self.fast_forward(bytes_used_from_backend)
except (HTTPException, ValueError):
raise exc_type, exc_value, exc_traceback
six.reraise(exc_type, exc_value, exc_traceback)
except RangeAlreadyComplete:
break
buf = ''
@ -865,7 +865,7 @@ class ResumingGetter(object):
# nothing more to do here.
return
else:
raise exc_type, exc_value, exc_traceback
six.reraise(exc_type, exc_value, exc_traceback)
else:
if buf and self.skip_bytes:
if self.skip_bytes < len(buf):