This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author martin.panter
Recipients martin.panter
Date 2014-03-24.06:25:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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 <>, 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):
        self.attr = self.__init__
        raise Exception()


Output from running this code:
[vadmium@localhost tmp]$ python3 -Wall
/usr/lib/python3.4/ DeprecationWarning: "site-python" directories will not be supported in 3.5 anymore
Traceback (most recent call last):
  File "", line 9, in <module>
  File "", line 7, in __init__
    raise 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:35martin.pantersetrecipients: + martin.panter
2014-03-24 06:25:35martin.pantersetmessageid: <>
2014-03-24 06:25:35martin.panterlinkissue21049 messages
2014-03-24 06:25:34martin.pantercreate