After https://github.com/jd/tenacity/pull/479 we changed the contents of the retry attribute for retry wrapped functions. However, it is useful that this attribute contains the reference to the retry object as it allows to modify its behaviour on-the-fly. Simply restoring the previous behaviour not possible, as they assume the contents of the retry attribute can be read, but recursive calls may end up overwriting the same context and make this invalid (see the discussion in #482). These changes restore the retry attribute, and update both tests and docs to make clear this is a write-only attribute and statistics should be read from the separate statistics attribute in the wrapped function.
Fixes #482
After https://github.com/jd/tenacity/pull/479 we changed the contents of the
retry
attribute for retry wrapped functions. However, it is useful that this attribute contains the reference to the retry object as it allows to modify its behaviour on-the-fly. Simply restoring the previous behaviour not possible, as they assume the contents of theretry
attribute can be read, but recursive calls may end up overwriting the same context and make this invalid (see the discussion in #482). These changes restore theretry
attribute, and update both tests and docs to make clear this is a write-only attribute and statistics should be read from the separatestatistics
attribute in the wrapped function.