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
diff --git a/lib/py/setup.py b/lib/py/setup.py
index d065573..3d14118 100644
--- a/lib/py/setup.py
+++ b/lib/py/setup.py
@@ -121,6 +121,7 @@
**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 dedeec3..960b0d0 100644
--- a/lib/py/src/ext/binary.h
+++ b/lib/py/src/ext/binary.h
@@ -113,7 +113,8 @@
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 @@
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 @@
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 5bba237..a78d7a7 100644
--- a/lib/py/src/ext/compact.h
+++ b/lib/py/src/ext/compact.h
@@ -162,7 +162,8 @@
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 6e978d7..c025d0c 100644
--- a/lib/py/src/ext/protocol.tcc
+++ b/lib/py/src/ext/protocol.tcc
@@ -102,7 +102,7 @@
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 16fd9be..e485cff 100644
--- a/lib/py/src/protocol/TCompactProtocol.py
+++ b/lib/py/src/protocol/TCompactProtocol.py
@@ -42,6 +42,8 @@
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 @@
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 67ee04e..26c0f7e 100644
--- a/lib/py/src/server/TNonblockingServer.py
+++ b/lib/py/src/server/TNonblockingServer.py
@@ -62,6 +62,7 @@
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 8ad4ce4..ab00cb2 100644
--- a/lib/py/src/transport/sslcompat.py
+++ b/lib/py/src/transport/sslcompat.py
@@ -96,4 +96,5 @@
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 8951618..3c4be9c 100644
--- a/lib/py/test/test_sslsocket.py
+++ b/lib/py/test/test_sslsocket.py
@@ -334,6 +334,7 @@
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 fc1e79c..40e7a47 100644
--- a/lib/py/test/thrift_json.py
+++ b/lib/py/test/thrift_json.py
@@ -46,5 +46,6 @@
unicode_text = unicode_text.encode('utf8')
self.assertEqual(protocol.readString(), unicode_text)
+
if __name__ == '__main__':
unittest.main()