Skip to content

Commit 57e2eea

Browse files
committed
driver-six
1 parent 65a2d00 commit 57e2eea

File tree

5 files changed

+9
-20
lines changed

5 files changed

+9
-20
lines changed

cassandra/concurrent.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,15 +145,14 @@ def _execute(self, idx, statement, params):
145145
except Exception as exc:
146146
# exc_info with fail_fast to preserve stack trace info when raising on the client thread
147147
# (matches previous behavior -- not sure why we wouldn't want stack trace in the other case)
148-
e = exc
149148

150149
# If we're not failing fast and all executions are raising, there is a chance of recursing
151150
# here as subsequent requests are attempted. If we hit this threshold, schedule this result/retry
152151
# and let the event loop thread return.
153152
if self._exec_depth < self.max_error_recursion:
154-
self._put_result(e, idx, False)
153+
self._put_result(exc, idx, False)
155154
else:
156-
self.session.submit(self._put_result, e, idx, False)
155+
self.session.submit(self._put_result, exc, idx, False)
157156
self._exec_depth -= 1
158157

159158
def _on_success(self, result, future, idx):

cassandra/cqltypes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
_little_endian_flag = 1 # we always serialize LE
5757
import ipaddress
5858

59-
lambda x: x
59+
_ord = lambda x: x
6060

6161
apache_cassandra_type_prefix = 'org.apache.cassandra.db.marshal.'
6262

@@ -644,7 +644,7 @@ def serialize(v, protocol_version):
644644
raise TypeError('DateType arguments must be a datetime, date, or timestamp')
645645
timestamp = v
646646

647-
return int64_pack(int(timestamp))
647+
return int64_pack(timestamp)
648648

649649

650650
class TimestampType(DateType):

tests/integration/datatype_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
from decimal import Decimal
1616
from datetime import datetime, date, time
17-
from uuid import uuid1, uuid4
1817
import ipaddress
18+
from uuid import uuid1, uuid4
1919

2020
from cassandra.util import OrderedMap, Date, Time, sortedset, Duration
2121

tests/integration/standard/test_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import unittest
1615
import ipaddress
16+
import unittest
1717

1818
from datetime import datetime
1919
import math

tests/unit/test_policies.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -142,26 +142,16 @@ def host_down():
142142

143143
# make the GIL switch after every instruction, maximizing
144144
# the chance of race conditions
145-
check = '__pypy__' in sys.builtin_module_names
146-
if check:
147-
original_interval = sys.getcheckinterval()
148-
else:
149-
original_interval = sys.getswitchinterval()
145+
original_interval = sys.getswitchinterval()
150146

151147
try:
152-
if check:
153-
sys.setcheckinterval(0)
154-
else:
155-
sys.setswitchinterval(0.0001)
148+
sys.setswitchinterval(0.0001)
156149
for t in threads:
157150
t.start()
158151
for t in threads:
159152
t.join()
160153
finally:
161-
if check:
162-
sys.setcheckinterval(original_interval)
163-
else:
164-
sys.setswitchinterval(original_interval)
154+
sys.setswitchinterval(original_interval)
165155

166156
if errors:
167157
self.fail("Saw errors: %s" % (errors,))

0 commit comments

Comments
 (0)