Python dictionary watchers no longer trigger when an object's attributes change
Bug report
Here's an example function using test_capi/test_watchers.py that passes in 3.12, but fails in 3.13 and 3.14:
def test_watch_obj_dict(self): o = MyClass() with self.watcher() as wid: self.watch(wid, o.__dict__) o.foo = "bar" self.assert_events(["new:foo:bar"]) # fails in 3.13+
The dictionary watcher doesn't fire in 3.13+ even though the o.__dict__ changes when o.foo is set to "bar". The problem is specific to inline values -- our code paths for inline values do not trigger dictionary watcher events. If the object does not use inline values, then the watcher events fire as expected.
This is a problem for PyTorch Dyanmo because it uses dictionary watchers for compiler guards.