MCPcopy Create free account
hub / github.com/RedisGears/RedisGears / RedisGearsPy_PyObjectSerialize

Function RedisGearsPy_PyObjectSerialize

plugins/python/redisgears_python.c:6029–6046  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6027}
6028
6029int 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
6048void* RedisGearsPy_PyObjectDeserialize(Gears_BufferReader* br){
6049 RedisGearsPy_LOCK

Callers 1

PythonRecord_SerializeFunction · 0.85

Calls 2

getPyErrorFunction · 0.85
GearsPyDecRefFunction · 0.85

Tested by

no test coverage detected