Message258040
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. |
|
Date |
User |
Action |
Args |
2016-01-11 23:52:45 | martin.panter | set | recipients:
+ martin.panter, gvanrossum, vstinner, benhoyt, serhiy.storchaka |
2016-01-11 23:52:45 | martin.panter | set | messageid: <1452556365.52.0.536568542679.issue25994@psf.upfronthosting.co.za> |
2016-01-11 23:52:45 | martin.panter | link | issue25994 messages |
2016-01-11 23:52:45 | martin.panter | create | |
|