On DragonFly BSD, TemporaryDirectory.cleanup() fails to remove a directory containing files or directories with the UF_NOUNLINK flag set (as exercised by test.test_tempfile...test_cleanup_with_symlink_flags).
Unlike FreeBSD, DragonFly's unlink() on a UF_NOUNLINK file fails with EISDIR (IsADirectoryError) instead of EPERM. The cleanup's onexc handler only resets flags for PermissionError, so the IsADirectoryError propagates and the flags are never cleared:
IsADirectoryError: [Errno 21] Is a directory: '.../test0.txt'
Handling IsADirectoryError the same way as PermissionError fixes it. Related: gh-91133.