[dynamo][guards] Fail on an unknown framelocals to dict conversion (#162695)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/162695
Approved by: https://github.com/williamwen42
ghstack dependencies: #162694
This commit is contained in:
Animesh Jain 2025-09-10 22:23:00 -07:00 committed by PyTorch MergeBot
parent a3a40cb741
commit a8432bcaad

View File

@ -2648,9 +2648,7 @@ class GuardAccessor {
// subtree on immutable dict getitems.
virtual bool check_nopybind(PyObject* obj, bool matches_dict_tag = false) = 0;
virtual bool check_nopybind(FrameLocalsMapping* map, bool matches_dict_tag) {
// throw std::runtime_error("fallback to python");
// Could fallback to running check on the Python dict (lazily constructed)
return check_nopybind((PyObject*)map->to_dict(), matches_dict_tag);
throw std::runtime_error("fallback to python");
}
virtual GuardDebugInfo check_verbose_nopybind(PyObject* obj) = 0;
virtual std::string repr() const = 0;