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 serhiy.storchaka
Recipients davin, jnoller, martin.panter, pitrou, python-dev, sbt, serhiy.storchaka, vstinner
Date 2016-03-25.11:07:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1458904070.03.0.836055071169.issue25654@psf.upfronthosting.co.za>
In-reply-to
Content
> Oops, I forgot to discuss the second part :-) You also added "sys.__stderr__ = sys.stderr" in multiprocessing.

At the start of PyImport_Cleanup() sys.stdXXX is set to sys.__stdXXX__. If sys.stdXXX is not sys.__stdXXX__ and here is the last reference to the stream, this causes deallocating sys.stdXXX and emitting a resource warning. If set sys.__stdXXX__ to sys.stdXXX, deallocating the stream is deferred to the end of PyImport_Cleanup(). Other changes make PyImport_Cleanup() to close standard streams explicitly before deallocating, thus resource warning are not emitted.

This workaround is not needed if deallocating sys.stdin doesn't emit a resource warning (since it is opened with closefd=False). But it still may be needed in tests if apply proposed changes to PyImport_Cleanup(), since sys.stderr is set to a file opened with closefd=True.
History
Date User Action Args
2016-03-25 11:07:50serhiy.storchakasetrecipients: + serhiy.storchaka, pitrou, vstinner, jnoller, python-dev, sbt, martin.panter, davin
2016-03-25 11:07:50serhiy.storchakasetmessageid: <1458904070.03.0.836055071169.issue25654@psf.upfronthosting.co.za>
2016-03-25 11:07:50serhiy.storchakalinkissue25654 messages
2016-03-25 11:07:49serhiy.storchakacreate