New submission from Martin Panter: 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 ---------- messages: 214671 nosy: vadmium priority: normal severity: normal status: open title: Flood of “ImportWarning: sys.meta_path is empty” after exception with socket subclass type: behavior versions: Python 3.4 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21049> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com