[New-bugs-announce] [issue43707] onerror in tempfile has an invalid raise expression
report at bugs.python.org
Fri Apr 2 13:57:47 EDT 2021
New submission from Maximilian Roos <m at maxroos.com>:
The raise expression [here](https://github.com/python/cpython/blob/ad442a674ca443feec43a88a2d3671784712e550/Lib/tempfile.py#L826) isn't valid, since it isn't in an except block.
It'll still raise, given it's invalid, though not with the exception it should be raising with...
I think this diff will fix it, I can put this in as a PR if that's reasonable. Though I'm not sure how to test it — we need to generate an error that's not covered by the existing cases.
diff --git a/Lib/tempfile.py b/Lib/tempfile.py
index efcf7a7fb3..227e25d0fc 100644
@@ -823,7 +823,7 @@ def resetperms(path):
if not ignore_errors:
+ raise exc_info
components: Library (Lib)
title: onerror in tempfile has an invalid raise expression
versions: Python 3.10
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce