mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-24 15:44:58 +08:00
[JIT] Improve source attribution for NamedTuple type inference (#95761)
Most errors thrown during torchscript scripting or execution have a SourceRange attached that can be used to identify where the error is coming from. NamedTuple type inference previously didn't have SourceRanges attached; this PR adds them. Differential Revision: [D43685662](https://our.internmc.facebook.com/intern/diff/D43685662) Pull Request resolved: https://github.com/pytorch/pytorch/pull/95761 Approved by: https://github.com/eellison
This commit is contained in:
committed by
PyTorch MergeBot
parent
053205aab5
commit
b35e67142c
@ -1012,7 +1012,7 @@ TypePtr registerNamedTuple(const py::object& obj, const SourceRange& loc) {
|
||||
py::module::import("torch._jit_internal").attr("_qualified_name")(obj)));
|
||||
|
||||
py::object props = py::module::import("torch._jit_internal")
|
||||
.attr("_get_named_tuple_properties")(obj);
|
||||
.attr("_get_named_tuple_properties")(obj, loc);
|
||||
|
||||
std::string unqualName;
|
||||
std::vector<std::string> field_names;
|
||||
|
||||
Reference in New Issue
Block a user