New submission from Maximilian Roos :
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
diff --git a/Lib/tempfile.py b/Lib/tempfile.py
index efcf7a7fb3..227e25d0fc 100644
--- a/Lib/tempfile.py
+++ b/Lib/tempfile.py
@@ -823,7 +823,7 @@ def resetperms(path):
pass
else:
if not ignore_errors:
-raise
+raise exc_info[1]
_shutil.rmtree(name, onerror=onerror)
```
--
components: Library (Lib)
messages: 390084
nosy: max-sixty
priority: normal
severity: normal
status: open
title: onerror in tempfile has an invalid raise expression
type: behavior
versions: Python 3.10
___
Python tracker
<https://bugs.python.org/issue43707>
___
___
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com