Closed samschott closed 4 years ago
Hmm, these kind of obscure errors make me think that implementing __del__
is maybe not worth the hassle..... On the other hand I'd really like Pyro to free resources it doesn't need anymore when a proxy gets destroyed...
In my experience, this particular type of error indeed only occurs when the whole interpreter is shutting down. I don't really like sprinkling all sorts of extra attribute / None checks in the del method, but maybe that's the only way to prevent these kind of errors from leaking out
Yes, I fully understand. And it’s a very rare issue.
A possible alternative to implementing ˋdelˋ with proper checks and exception handling may be to provide a context manager, i.e., ˋenterˋ and ˋexitˋ methods. But it would only be practical if the Proxy is only used temporarily.
This is actually how I am using Pyro Proxies myself at the moment.
Those context manager methods are already present.
Right, somehow I had overlooked that.
In rare cases, an unexpected error is raised when a Proxy instance gets deleted / garbage collected:
The relevant line in
Pyro4.client.Proxy
is:This issue has been introduced with 217af7b11b6a4f7231bbe88df2bd197d35ca839a and seems to only occur when exiting the interpreter.