[BE][Ez] Update deprecated pybind11 functions (#154798)

* getType() is deprecated, replace it with new/proper static method. These are backwards compatible with old pybind11 versions we support. So break this off before we upgrade to pybind11 3.0 where these methods are dropped in #154115

Pull Request resolved: https://github.com/pytorch/pytorch/pull/154798
Approved by: https://github.com/jansel, https://github.com/cyyever
This commit is contained in:
Aaron Gokaslan
2025-06-01 06:17:48 +00:00
committed by PyTorch MergeBot
parent bfae151269
commit 0cd18ba1ca
11 changed files with 36 additions and 29 deletions

View File

@ -21,7 +21,7 @@
namespace torch::jit {
std::string typeString(py::handle h) {
return py::str(h.get_type().attr("__name__"));
return py::str(py::type::handle_of(h).attr("__name__"));
}
std::optional<StrongFunctionPtr> as_function(const py::object& obj) {