Skip to content

Conversation

@cosmicexplorer
Copy link
Contributor

@cosmicexplorer cosmicexplorer commented Jul 28, 2023

Problem

main is currently broken on 3.12:

> nox -e test-3.12 -- -k test_tempdir_cleanup_ignore_errors
...
FAILED tests/unit/test_utils_temp_dir.py::test_tempdir_cleanup_ignore_errors - TypeError: 'PermissionError' object is not subscriptable

While it seems like #11394 may have been the direct trigger for the test failure, it appears the error was first introduced earlier in a hasty attempt to remove some DeprecationWarnings (25f4e6e). It turns out that while the documentation at https://docs.python.org/3.12/library/shutil.html#shutil.rmtree still uses the name "excinfo" for the third argument to onexc, onexc actually has a BaseException for the third argument instead of a sys.exc_info(), as per https://docs.python.org/3.12/whatsnew/3.12.html#shutil.

Solution

  • Since we don't use the sys.exc_info() parts anywhere, just convert any sys.exc_info() to a BaseException in our callback wrapper, and switch to explicitly only handling BaseException in our error callbacks.
- as per https://docs.python.org/3.12/whatsnew/3.12.html#shutil, we must expect only an exception
  and *not* the full exc_info from the new onexc function (the documentation of this is very
  misleading and still uses the label "excinfo":
  https://docs.python.org/3.12/library/shutil.html#shutil.rmtree)
@uranusjr uranusjr merged commit b69ed81 into pypa:main Jul 30, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

2 participants