mirror of
https://github.com/wassname/ray.git
synced 2026-06-28 23:25:54 +08:00
Prevent ObjectIDs from being pickled. (#42)
This commit is contained in:
committed by
Philipp Moritz
parent
da3a3127e0
commit
db6375701e
@@ -51,9 +51,17 @@ static PyObject *PyObjectID_id(PyObject *self) {
|
||||
UNIQUE_ID_SIZE);
|
||||
}
|
||||
|
||||
static PyObject *PyObjectID___reduce__(PyObjectID *self) {
|
||||
PyErr_SetString(CommonError, "ObjectID objects cannot be serialized.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static PyMethodDef PyObjectID_methods[] = {
|
||||
{"id", (PyCFunction) PyObjectID_id, METH_NOARGS,
|
||||
"Return the hash associated with this ObjectID"},
|
||||
{"__reduce__", (PyCFunction) PyObjectID___reduce__, METH_NOARGS,
|
||||
"Say how to pickle this ObjectID. This raises an exception to prevent"
|
||||
"object IDs from being serialized."},
|
||||
{NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user