Skip to content

Commit 5fc3e66

Browse files
committed
int is always long
1 parent 5c01e35 commit 5fc3e66

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

libmc/_client.pyx

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,6 @@ cdef cas_unique_t DEFAULT_CAS_UNIQUE = 0
257257
cdef flags_t _FLAG_DOUBAN_CHUNKED = 1 << 12
258258
cdef int _DOUBAN_CHUNK_SIZE = 1000000
259259

260-
INT_UPPER_BOUND = PyInt_FromLong(1) << 63
261-
262260
MC_DEFAULT_EXPTIME = PyInt_FromLong(DEFAULT_EXPTIME)
263261
MC_POLL_TIMEOUT = PyInt_FromLong(CFG_POLL_TIMEOUT)
264262
MC_CONNECT_TIMEOUT = PyInt_FromLong(CFG_CONNECT_TIMEOUT)
@@ -299,16 +297,7 @@ cdef bytes _encode_value(object val, int comp_threshold, flags_t *flags):
299297
flags[0] = _FLAG_BOOL
300298
enc_val = b'1' if val else b'0'
301299
elif type_ is int:
302-
# compatible with libmc on Python2
303-
print('int upper bound:', INT_UPPER_BOUND)
304-
print('val:', val)
305-
print(-INT_UPPER_BOUND <= val)
306-
print(val < INT_UPPER_BOUND)
307-
print(-INT_UPPER_BOUND <= val < INT_UPPER_BOUND)
308-
if -INT_UPPER_BOUND <= val and val < INT_UPPER_BOUND:
309-
flags[0] = _FLAG_INTEGER
310-
else:
311-
flags[0] = _FLAG_LONG
300+
flags[0] = _FLAG_LONG
312301
enc_val = str(val).encode('ascii')
313302
elif type_.__module__ == 'numpy':
314303
enc_val = pickle.dumps(val, 2)

tests/test_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def test_encode_value(self):
3838
),
3939
(
4040
b'1234567890',
41-
2,
41+
4,
4242
123_456_789_0,
4343
),
4444
(

0 commit comments

Comments
 (0)