mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Fix handle serialization error (#131871)
This is a bug to try serialise std::string in C API Co-authored-by: Aaron Gokaslan <aaronGokaslan@gmail.com> Pull Request resolved: https://github.com/pytorch/pytorch/pull/131871 Approved by: https://github.com/Skylion007
This commit is contained in:
@ -156,15 +156,16 @@ static PyObject* THPEvent_from_ipc_handle(
|
||||
END_HANDLE_TH_ERRORS
|
||||
}
|
||||
|
||||
static PyObject* THPEvent_ipc_handle(PyObject* _self, PyObject* noargs) {
|
||||
static PyObject* THPEvent_ipc_handle(
|
||||
PyObject* _self [[maybe_unused]],
|
||||
PyObject* noargs) {
|
||||
HANDLE_TH_ERRORS
|
||||
auto self = (THPEvent*)_self;
|
||||
(void)self;
|
||||
TORCH_CHECK_NOT_IMPLEMENTED(
|
||||
false,
|
||||
"torch.Event ipc is not supported yet, please open an issue if you need this!");
|
||||
std::string handle = "0";
|
||||
return PyBytes_FromStringAndSize((const char*)&handle, sizeof(handle));
|
||||
constexpr const char* handle = "0";
|
||||
return PyBytes_FromStringAndSize(
|
||||
handle, std::char_traits<char>::length(handle));
|
||||
END_HANDLE_TH_ERRORS
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user