EnricoMi commented on code in PR #47339: URL: https://github.com/apache/arrow/pull/47339#discussion_r2292748473
########## python/pyarrow/_parquet_encryption.pyx: ########## @@ -300,20 +306,29 @@ cdef class KmsConnectionConfig(_Weakrefable): # Callback definitions for CPyKmsClientVtable cdef void _cb_wrap_key( - handler, const c_string& key_bytes, + handler, const CSecureString& key, const c_string& master_key_identifier, c_string* out) except *: + cdef: + cpp_string_view view = key.as_view() + key_bytes = PyObject_to_object( + PyBytes_FromStringAndSizeNative(view.data(), view.size())) mkid_str = frombytes(master_key_identifier) wrapped_key = handler.wrap_key(key_bytes, mkid_str) out[0] = tobytes(wrapped_key) cdef void _cb_unwrap_key( handler, const c_string& wrapped_key, - const c_string& master_key_identifier, c_string* out) except *: + const c_string& master_key_identifier, shared_ptr[CSecureString]* out) except *: mkid_str = frombytes(master_key_identifier) wk_str = frombytes(wrapped_key) key = handler.unwrap_key(wk_str, mkid_str) - out[0] = tobytes(key) + + cdef: Review Comment: Cython doesn't like the definition of a C_string: ``` Error compiling Cython file: ------------------------------------------------------------ ... cdef void _cb_unwrap_key( handler, const c_string& wrapped_key, const c_string& master_key_identifier, CSecureString& out) except *: c_string cstr ^ ------------------------------------------------------------ pyarrow/_parquet_encryption.pyx:323:13: Syntax error in simple statement list ``` Without the `cdef` of `c_string cstr`, it fails with ``` Error compiling Cython file: ------------------------------------------------------------ ... const c_string& master_key_identifier, CSecureString& out) except *: mkid_str = frombytes(master_key_identifier) wk_str = frombytes(wrapped_key) key = handler.unwrap_key(wk_str, mkid_str) cstr = tobytes(key) out = CSecureString(move(cstr)) ^ ------------------------------------------------------------ pyarrow/_parquet_encryption.pyx:327:23: no suitable method found ``` -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org