isapego commented on code in PR #4401:
URL: https://github.com/apache/ignite-3/pull/4401#discussion_r1762563465


##########
modules/platforms/python/cpp_module/type_conversion.h:
##########
@@ -171,8 +332,39 @@ static void submit_pyobject(ignite::binary_tuple_builder 
&builder, PyObject *obj
         return;
     }
 
+    if (PyBytes_Check(obj)) {
+        auto *data = reinterpret_cast<std::byte*>(PyBytes_AsString(obj));
+        auto len = PyBytes_Size(obj);
+        ignite::bytes_view view(data, len);
+
+        if (claim) {
+            ignite::protocol::claim_type_and_scale(builder, 
ignite::ignite_type::BYTE_ARRAY);
+            builder.claim_varlen(view);
+        } else {
+            ignite::protocol::append_type_and_scale(builder, 
ignite::ignite_type::BYTE_ARRAY);
+            builder.append_varlen(view);
+        }
+        return;
+    }
+
+    if (PyBool_Check(obj)) {
+        bool val = (obj == Py_True);
+        if (claim) {
+            ignite::protocol::claim_type_and_scale(builder, 
ignite::ignite_type::BOOLEAN);
+            builder.claim_bool(val);
+        } else {
+            ignite::protocol::append_type_and_scale(builder, 
ignite::ignite_type::BOOLEAN);
+            builder.append_bool(val);
+        }
+        return;
+    }
+
     if (PyFloat_Check(obj)) {
         double val = PyFloat_AsDouble(obj);
+        if (PyErr_Occurred()) {
+            throw ignite::ignite_error("Can not convert FLOAT to a double");

Review Comment:
   In my understanding, it should not be possible, but this is not clarified in 
the documentation, so I just decided to play safe.



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to