Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! gh-119333: Back up exception before calling PyContext_WatchCal…
…lback I changed my mind about where to back up and restore the exception. Instead of backing up and restoring once outside the loop over the registered callbacks, the exception is backed up and restored each time a callback is called. This avoids concerns about what happens if a callback raises an exception but returns non-negative. This is also expected to be more efficient, not less, because the common case is no watchers at all, in which case there is no backup/restore overhead. The second most common case is one watcher, which is no less efficient than before. The only time this is more expensive is when there are two or more watchers, in which case the overhead of the watcher callbacks probably dwarfs the overhead of the extra backups anyways.
- Loading branch information