markjm commented on code in PR #3595:
URL: https://github.com/apache/thrift/pull/3595#discussion_r3407597543
##########
lib/py/src/ext/protocol.tcc:
##########
@@ -456,18 +456,32 @@ bool ProtocolBase<Impl>::encodeValue(PyObject* value,
TType type, PyObject* type
case T_STRING: {
ScopedPyObject nval;
+ Py_ssize_t len;
if (PyUnicode_Check(value)) {
+#if PY_VERSION_HEX >= 0x03030000
+ const char* str = PyUnicode_AsUTF8AndSize(value, &len);
+ if (!str) {
+ return false;
+ }
+ if (!detail::check_ssize_t_32(len)) {
+ return false;
+ }
+
+ impl()->writeI32(static_cast<int32_t>(len));
+ return writeBuffer(const_cast<char*>(str), static_cast<size_t>(len));
Review Comment:
thanks bot
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]