cicku / libproxy

Automatically exported from code.google.com/p/libproxy
GNU Lesser General Public License v2.1
1 stars 0 forks source link

Error messages from __del__() #176

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
There's a bug in ProxyFactory.__del__() method. It relies on _libproxy module 
being available but at shutdown it may be already unloaded.  There's no easy 
way to reproduce it (depends on python internals as finalization order).  When 
my application using libproxy exits, I see this error message:

Exception AttributeError: "'NoneType' object has no attribute 
'px_proxy_factory_free'" in <bound method ProxyFactory.__del__ of 
<libproxy.ProxyFactory object at 0xb7486f4c>> ignored

What version of the product are you using? On what operating system?

libproxy-python-0.4.4-7.fc14.noarch

The following patch fixes the issue.

--- /usr/lib/python2.7/site-packages/libproxy.py.old
+++ /usr/lib/python2.7/site-packages/libproxy.py
@@ -121,5 +121,6 @@
         return proxies

     def __del__(self):
-        _libproxy.px_proxy_factory_free(self._pf)
+        if _libproxy:
+            _libproxy.px_proxy_factory_free(self._pf)

Original issue reported on code.google.com by zde...@gmail.com on 13 Mar 2012 at 1:20

GoogleCodeExporter commented 8 years ago
Thank you very much for your report.

Is a rather cosmetic bug, but I'll merge the fix soon.
Generally your application should perform 'cleanup' before 'quitting' (you 
would want to tear down and close open files hopefully too).

Original comment by dominiqu...@gmail.com on 14 Mar 2012 at 8:02

GoogleCodeExporter commented 8 years ago
This issue was closed by revision r838.

Original comment by dominiqu...@gmail.com on 14 Mar 2012 at 9:13