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


##########
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:
   Ok, I've checked the sources and found that if the object is Double, we 
[should not do any 
checks](https://github.com/python/cpython/blob/14e5bdceff45e6e789e1f838b96988946c75b0f4/Objects/floatobject.c#L262).
 Changed to `PyFloat_AS_DOUBLE`.



-- 
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