typed_python
typed_python copied to clipboard
deserializePythonObjectFromName has unreachable code
In typed_python/PythonSerializationContext_deserialization.cpp
, line 256, in the deserializePythonObjectFromName function, the second error type "Object named
PyObject* PythonSerializationContext::deserializePythonObjectFromName(DeserializationBuffer& b, size_t wireType, int64_t memo) const {
PyEnsureGilAcquired acquireTheGil;
assertWireTypesEqual(wireType, WireType::BYTES);
std::string name = b.readStringObject();
PyObject* result = PyObject_CallMethod(mContextObj, "objectFromName", "s", name.c_str());
if (!result) {
throw PythonExceptionSet();
}
if (result == Py_None){
throw std::runtime_error("Failed to deserialize Type '" + name + "'");
}
if (result == Py_None) {
throw std::runtime_error(
"Object named " + name + " doesn't exist in this codebase. Perhaps you "
"are deserializing an object from an earlier codebase?"
);
}
if (memo != -1) {
b.addCachedPyObj(memo, incref(result));
}
return result;
}```