pytorch/torch/csrc/jit/python
Charlie West-Taylor cfd552547f Use the Python frame safely in _pythonCallstack (#88993)
Currently, the result of `PyEval_GetFrame()` is piped straight to `Py_INCREF`. However, `PyEval_GetFrame` [may return null](https://docs.python.org/3/c-api/reflection.html#c.PyEval_GetFrame), which seems to be the case sometimes, when calling `_pythonCallstack` from another thread. This is handled in the subsequent `while (nullptr != frame)` block, but `Py_INCREF`, called before it, [doesn't handle this case](https://docs.python.org/3/c-api/refcounting.html#c.Py_INCREF), so the program segfaults. The safe form of `Py_INCREF` is `Py_XINCREF`, so use that instead ([docs](https://docs.python.org/3/c-api/refcounting.html#c.Py_XINCREF)).
Pull Request resolved: https://github.com/pytorch/pytorch/pull/88993
Approved by: https://github.com/albanD
2022-11-17 00:59:15 +00:00
..
init.cpp Fix XLA symbolic shapes binding (#88928) 2022-11-13 00:31:27 +00:00
init.h
module_python.h Improve torch::jit::as_{module,object} performance (#84399) 2022-09-07 16:58:28 +00:00
pybind_utils.cpp Unify SymIntNode and SymFloatNode into SymNode (#87817) 2022-10-27 20:56:02 +00:00
pybind_utils.h Fix: prefer .is_none() over .is(py::none()) for pybind11 (#88051) 2022-10-31 16:41:27 +00:00
pybind.h
python_arg_flatten.cpp
python_arg_flatten.h
python_custom_class.cpp
python_custom_class.h
python_dict.cpp
python_dict.h
python_interpreter.cpp
python_ir.cpp Fix Python-bound function signature (torch._C.Graph.addInput) (#88528) 2022-11-09 01:31:45 +00:00
python_ir.h
python_ivalue.h
python_list.cpp
python_list.h
python_sugared_value.cpp Fix: prefer .is_none() over .is(py::none()) for pybind11 (#88051) 2022-10-31 16:41:27 +00:00
python_sugared_value.h
python_tracer.cpp Use the Python frame safely in _pythonCallstack (#88993) 2022-11-17 00:59:15 +00:00
python_tracer.h Support unpacking python dictionary in torch.jit.trace() (#81623) 2022-10-15 05:33:09 +00:00
python_tree_views.cpp
python_tree_views.h
script_init.cpp Fix typos in messages under torch (#88961) 2022-11-14 19:06:41 +00:00
script_init.h
update_graph_executor_opt.cpp
update_graph_executor_opt.h