| 6027 | } |
| 6028 | |
| 6029 | int RedisGearsPy_PyObjectSerialize(void* arg, Gears_BufferWriter* bw, char** err){ |
| 6030 | RedisGearsPy_LOCK |
| 6031 | PyObject* obj = arg; |
| 6032 | PyObject* objStr = PyMarshal_WriteObjectToString(obj, Py_MARSHAL_VERSION); |
| 6033 | if(!objStr){ |
| 6034 | *err = getPyError(); |
| 6035 | RedisModule_Log(staticCtx, "warning", "Error occured on RedisGearsPy_PyObjectSerialize, error=%s", *err); |
| 6036 | RedisGearsPy_UNLOCK |
| 6037 | return REDISMODULE_ERR; |
| 6038 | } |
| 6039 | size_t len; |
| 6040 | char* objStrCstr; |
| 6041 | PyBytes_AsStringAndSize(objStr, &objStrCstr, &len); |
| 6042 | RedisGears_BWWriteBuffer(bw, objStrCstr, len); |
| 6043 | GearsPyDecRef(objStr); |
| 6044 | RedisGearsPy_UNLOCK |
| 6045 | return REDISMODULE_OK; |
| 6046 | } |
| 6047 | |
| 6048 | void* RedisGearsPy_PyObjectDeserialize(Gears_BufferReader* br){ |
| 6049 | RedisGearsPy_LOCK |
no test coverage detected