Explicitly decref in UnpickledPythonCall dtor (#38398)

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/38398

Test Plan: Imported from OSS

Differential Revision: D21550712

Pulled By: mrshenli

fbshipit-source-id: aac4708a5b6f6dc38149f995d11e27c190648859
This commit is contained in:
Shen Li
2020-06-04 22:33:47 -07:00
committed by Facebook GitHub Bot
parent 876b9591dc
commit fa4ed17183
5 changed files with 27 additions and 13 deletions

View File

@ -125,13 +125,14 @@ std::shared_ptr<torch::jit::CompilationUnit> PythonRpcHandler::
return jitCompilationUnit_;
}
py::object PythonRpcHandler::runPythonUdf(py::object&& pythonUdf) {
py::object PythonRpcHandler::runPythonUdf(const py::object& pythonUdf) {
PROFILE_GIL_SCOPED_ACQUIRE;
// Throw a descriptive error message if pyRunFunction_ is already cleaned up.
TORCH_INTERNAL_ASSERT_DEBUG_ONLY(
!pyRunFunction_.is_none(),
"Cannot run python UDF since pyRunFunction_ is None. Check if python RPC handler is already cleaned up.");
return pyRunFunction_(std::move(pythonUdf));
"Cannot run python UDF since pyRunFunction_ is None. Check if python RPC "
"handler is already cleaned up.");
return pyRunFunction_(pythonUdf);
}
SerializedPyObj PythonRpcHandler::serialize(const py::object& obj) {