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 vstinner
Recipients martin.panter, vstinner
Date 2017-09-25.09:29:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
socket.SocketIO inherits from io.RawIOBase which inherits from io.IOBase.

io.IOBase has a finalizer which calls the close() method. I tried to add a __del__ method to socket.SocketIO, but the object was already closed by the finalizer.

io.FileIO uses a trick at the C level: it sets an internal "finalizing" attribute to check if close() was called by IOBase finalizer. If it's the case, a ResourceWarning is emitted.

I don't see a simpler way to emit a ResourceWarning in SocketIO. Maybe it's not the right approach.
Date User Action Args
2017-09-25 09:29:01vstinnersetrecipients: + vstinner, martin.panter
2017-09-25 09:29:01vstinnersetmessageid: <>
2017-09-25 09:29:01vstinnerlinkissue31520 messages
2017-09-25 09:29:01vstinnercreate