Message214671
With the code included below, and warnings enabled, I see a flood of unexpected ImportWarnings as the interpreter exits. The issue is seen with Python 3.4.0, but apparently not with 3.3.5.
The issue originally happened with code using the Py Socks library <https://github.com/Anorov/PySocks>, which I interrupted because the connect() call was hanging. I have reduced it down to the following code:
import _socket
class socket(_socket.socket):
def __init__(self):
_socket.socket.__init__(self)
self.attr = self.__init__
raise Exception()
socket()
Output from running this code:
[vadmium@localhost tmp]$ python3 -Wall script.py
/usr/lib/python3.4/site.py:333: DeprecationWarning: "site-python" directories will not be supported in 3.5 anymore
DeprecationWarning)
Traceback (most recent call last):
File "script.py", line 9, in <module>
socket()
File "script.py", line 7, in __init__
raise Exception()
Exception
sys:1: ResourceWarning: unclosed <socket object, fd=3, family=2, type=1, proto=0>
/tmp/<frozen>:2127: ImportWarning: sys.meta_path is empty
/tmp/<frozen>:2127: ImportWarning: sys.meta_path is empty
. . .
[About two hundred lines]
. . .
/tmp/<frozen>:2127: ImportWarning: sys.meta_path is empty
/tmp/<frozen>:2127: ImportWarning: sys.meta_path is empty
[Exit 1]
[vadmium@localhost tmp]$
These seem to be conditions necessary to produce the issue:
* Instantiate a subclass of “_socket.socket”
* Assign a bound method to an attribute of the socket object
* Save the socket object in a local variable of a function, __init__() in my demonstration
* Raise an exception from the function holding the socket object |
|
Date |
User |
Action |
Args |
2014-03-24 06:25:35 | martin.panter | set | recipients:
+ martin.panter |
2014-03-24 06:25:35 | martin.panter | set | messageid: <1395642335.41.0.483787590936.issue21049@psf.upfronthosting.co.za> |
2014-03-24 06:25:35 | martin.panter | link | issue21049 messages |
2014-03-24 06:25:34 | martin.panter | create | |
|