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 benhoyt, gvanrossum, martin.panter, serhiy.storchaka, vstinner
Date 2016-01-11.23:52:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1452556365.52.0.536568542679.issue25994@psf.upfronthosting.co.za>
In-reply-to
Content
Guido are you saying in the following code, the “finally” message is not guaranteed to be printed out? Or just that you cannot limit a ResourceWarning to garbage collection?

def g():
    try:
        yield "item"
    finally:
        # Run at exhaustion, close(), and garbage collection
        print("finally")

gi = g()
try:
    item = next(gi)
    print(item / 2)  # Oops, TypeError
finally:
    # Should be run as the exception passes through. GeneratorExit is raised inside the generator, causing the other “finally” block to execute. All before the original exception is caught and a traceback is printed.
    gi.close()

But as I understand it, os.scandir() is not a generator, so none of these problems would apply.
History
Date User Action Args
2016-01-11 23:52:45martin.pantersetrecipients: + martin.panter, gvanrossum, vstinner, benhoyt, serhiy.storchaka
2016-01-11 23:52:45martin.pantersetmessageid: <1452556365.52.0.536568542679.issue25994@psf.upfronthosting.co.za>
2016-01-11 23:52:45martin.panterlinkissue25994 messages
2016-01-11 23:52:45martin.pantercreate