You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The README says "Note that this connection is reusable, closable and when it leaves scope it will clean up after itself."
I suspect that this is referring to CPython's reference counting garbage collection, but this is an implementation detail of CPython and not a specified behavior of the language.
On PyPy, I suspect following this advice would lead to leaks.
Thanks tilgovi, for pointing it out! I was under the impression that at least in an earlier version it was working. I went on quite a hunt.
Observations:
__exit__ was missing self.close
__del__ was there in an earlier version, but somehow disappeared.
__del__ makes sure that whenever it leaves scope, it indeed cleans up after itself in CPython
In PyPy, __del__ indeed does not trigger on leaving scope!
Using the context manager with does work though
It was a nice case for using the logging that's put in there; it made it super obvious.
I made a new commit (09b2a84), updating the README to watch out with PyPy and use with there. In CPython, with adding back in __del__, I don't believe we have anything to worry about. PyPy should use with to make sure it gets closed well.
Please verify that it works as you expect in yagmail 0.5.140, and feel free to close the issue or update it.
The README says "Note that this connection is reusable, closable and when it leaves scope it will clean up after itself."
I suspect that this is referring to CPython's reference counting garbage collection, but this is an implementation detail of CPython and not a specified behavior of the language.
On PyPy, I suspect following this advice would lead to leaks.
See also: http://doc.pypy.org/en/latest/cpython_differences.html#differences-related-to-garbage-collection-strategies
I would recommend removing this language from the README and encouraging people to always explicitly close connections.
The text was updated successfully, but these errors were encountered: