diff options
author | James E. King, III <jking@apache.org> | 2017-09-30 15:44:16 -0700 |
---|---|---|
committer | James E. King, III <jking@apache.org> | 2017-10-19 11:29:04 -0400 |
commit | 0ad20bdbfe9abcbb0cc5332ff95651b5c975da91 (patch) | |
tree | 7e713c9380844afe41019a7c6ebe4e508eba3464 /lib/py | |
parent | 8b8a8efea13d1c97f856053af0a5c0e6a8a76354 (diff) | |
download | thrift-0ad20bdbfe9abcbb0cc5332ff95651b5c975da91.tar.gz |
THRIFT-4351: use travis build stages to optimize build,
avoiding duplicate rebuilds of the same image, and also
allow personal docker hub repositories for private fork
builds to be optimized. Move ubsan build to artful image
because it catches more stuff and fix what was found.
THRIFT-4345: solidify docker build strategy for maximum
coverage: trusty, xenial, artful as stock as they can be
THRIFT-4344: add top level language summary markdown and
update readme with a new image on the layered architecture
THRIFT-3847: remove VERSION macro from config.h which
was causing a conflict on artful builds.
THRIFT-4359: fix haxe map/set decode when key is binary,
as a missing break statement caused it to use an int
during decode
This closes #1389
Diffstat (limited to 'lib/py')
-rw-r--r-- | lib/py/setup.py | 1 | ||||
-rw-r--r-- | lib/py/src/ext/binary.h | 9 | ||||
-rw-r--r-- | lib/py/src/ext/compact.h | 3 | ||||
-rw-r--r-- | lib/py/src/ext/protocol.tcc | 2 | ||||
-rw-r--r-- | lib/py/src/protocol/TCompactProtocol.py | 3 | ||||
-rw-r--r-- | lib/py/src/server/TNonblockingServer.py | 1 | ||||
-rw-r--r-- | lib/py/src/transport/sslcompat.py | 1 | ||||
-rw-r--r-- | lib/py/test/test_sslsocket.py | 1 | ||||
-rw-r--r-- | lib/py/test/thrift_json.py | 1 |
9 files changed, 17 insertions, 5 deletions
diff --git a/lib/py/setup.py b/lib/py/setup.py index d0655730b..3d1411812 100644 --- a/lib/py/setup.py +++ b/lib/py/setup.py @@ -121,6 +121,7 @@ def run_setup(with_binary): **extensions ) + try: with_binary = True run_setup(with_binary) diff --git a/lib/py/src/ext/binary.h b/lib/py/src/ext/binary.h index dedeec35b..960b0d003 100644 --- a/lib/py/src/ext/binary.h +++ b/lib/py/src/ext/binary.h @@ -113,7 +113,8 @@ public: if (!readBytes(&buf, sizeof(int16_t))) { return false; } - val = static_cast<int16_t>(ntohs(*reinterpret_cast<int16_t*>(buf))); + memcpy(&val, buf, sizeof(int16_t)); + val = ntohs(val); return true; } @@ -122,7 +123,8 @@ public: if (!readBytes(&buf, sizeof(int32_t))) { return false; } - val = static_cast<int32_t>(ntohl(*reinterpret_cast<int32_t*>(buf))); + memcpy(&val, buf, sizeof(int32_t)); + val = ntohl(val); return true; } @@ -131,7 +133,8 @@ public: if (!readBytes(&buf, sizeof(int64_t))) { return false; } - val = static_cast<int64_t>(ntohll(*reinterpret_cast<int64_t*>(buf))); + memcpy(&val, buf, sizeof(int64_t)); + val = ntohll(val); return true; } diff --git a/lib/py/src/ext/compact.h b/lib/py/src/ext/compact.h index 5bba23761..a78d7a703 100644 --- a/lib/py/src/ext/compact.h +++ b/lib/py/src/ext/compact.h @@ -162,7 +162,8 @@ public: if (!readBytes(&buf, 8)) { return false; } - transfer.f = letohll(*reinterpret_cast<int64_t*>(buf)); + memcpy(&transfer.f, buf, sizeof(int64_t)); + transfer.f = letohll(transfer.f); val = transfer.t; return true; } diff --git a/lib/py/src/ext/protocol.tcc b/lib/py/src/ext/protocol.tcc index 6e978d7c7..c025d0c96 100644 --- a/lib/py/src/ext/protocol.tcc +++ b/lib/py/src/ext/protocol.tcc @@ -102,7 +102,7 @@ inline bool ProtocolBase<Impl>::writeBuffer(char* data, size_t size) { PyErr_SetString(PyExc_IOError, "failed to write to cStringIO object"); return false; } - if (len != size) { + if (static_cast<size_t>(len) != size) { PyErr_Format(PyExc_EOFError, "write length mismatch: expected %lu got %d", size, len); return false; } diff --git a/lib/py/src/protocol/TCompactProtocol.py b/lib/py/src/protocol/TCompactProtocol.py index 16fd9be28..e485cffb1 100644 --- a/lib/py/src/protocol/TCompactProtocol.py +++ b/lib/py/src/protocol/TCompactProtocol.py @@ -42,6 +42,8 @@ def make_helper(v_from, container): return func(self, *args, **kwargs) return nested return helper + + writer = make_helper(VALUE_WRITE, CONTAINER_WRITE) reader = make_helper(VALUE_READ, CONTAINER_READ) @@ -94,6 +96,7 @@ class CompactType(object): MAP = 0x0B STRUCT = 0x0C + CTYPES = { TType.STOP: CompactType.STOP, TType.BOOL: CompactType.TRUE, # used for collection diff --git a/lib/py/src/server/TNonblockingServer.py b/lib/py/src/server/TNonblockingServer.py index 67ee04ed5..26c0f7e1f 100644 --- a/lib/py/src/server/TNonblockingServer.py +++ b/lib/py/src/server/TNonblockingServer.py @@ -62,6 +62,7 @@ class Worker(threading.Thread): logger.exception("Exception while processing request", exc_info=True) callback(False, b'') + WAIT_LEN = 0 WAIT_MESSAGE = 1 WAIT_PROCESS = 2 diff --git a/lib/py/src/transport/sslcompat.py b/lib/py/src/transport/sslcompat.py index 8ad4ce400..ab00cb2a8 100644 --- a/lib/py/src/transport/sslcompat.py +++ b/lib/py/src/transport/sslcompat.py @@ -96,4 +96,5 @@ def _optional_dependencies(): match = legacy_validate_callback return ipaddr, match + _match_has_ipaddress, _match_hostname = _optional_dependencies() diff --git a/lib/py/test/test_sslsocket.py b/lib/py/test/test_sslsocket.py index 8951618a9..3c4be9c2a 100644 --- a/lib/py/test/test_sslsocket.py +++ b/lib/py/test/test_sslsocket.py @@ -334,6 +334,7 @@ class TSSLSocketTest(unittest.TestCase): self._assert_connection_success(server, ssl_context=client_context) + if __name__ == '__main__': logging.basicConfig(level=logging.WARN) from thrift.transport.TSSLSocket import TSSLSocket, TSSLServerSocket, _match_has_ipaddress diff --git a/lib/py/test/thrift_json.py b/lib/py/test/thrift_json.py index fc1e79cc7..40e7a47e3 100644 --- a/lib/py/test/thrift_json.py +++ b/lib/py/test/thrift_json.py @@ -46,5 +46,6 @@ class TestJSONString(unittest.TestCase): unicode_text = unicode_text.encode('utf8') self.assertEqual(protocol.readString(), unicode_text) + if __name__ == '__main__': unittest.main() |