Skip to content

gh-157579: Fix TemporaryDirectory cleanup fallbacks with bytes paths - #162116

Merged
encukou merged 6 commits into
python:mainfrom
encukou:tempdir-cleanup-bytes
Nov 18, 2026
Merged

encukou merged 6 commits into
python:mainfrom
encukou:tempdir-cleanup-bytes

Conversation

@encukou

@encukou encukou commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

When porting GH-157580 to 3.11, @omercnet and I noticed (independently) that tempfile.TemporaryDirectory's cleanup error handling can't handle bytes paths.

This fixes that, and adds tests written for GH-161944 (the 3.11 backport).

Comment thread Lib/test/test_shutil.py Outdated
os.stat(os.path.join(TESTFN, path)),
os.stat(name, dir_fd=dir_fd)))

def rmtree():

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused?

Comment thread Lib/test/test_tempfile.py Resolved
Comment thread Lib/test/test_shutil.py Resolved
encukou and others added 2 commits November 18, 2026 13:07
Co-authored-by: Stan Ulbrych <stan@python.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
@encukou
encukou enabled auto-merge (squash) November 18, 2026 12:07
@encukou encukou added needs backport to 3.12 only security fixes needs backport to 3.13 only security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 bugs and security fixes labels Nov 18, 2026
@encukou

encukou commented Nov 18, 2026

Copy link
Copy Markdown
Member Author

Thank you!

@encukou
encukou merged commit aa17c68 into python:main Nov 18, 2026
62 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @encukou for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13, 3.14, 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Nov 18, 2026

Copy link
Copy Markdown

GH-162208 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 bugs and security fixes label Nov 18, 2026
@bedevere-app

bedevere-app Bot commented Nov 18, 2026

Copy link
Copy Markdown

GH-162209 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Nov 18, 2026
@miss-islington-app

Copy link
Copy Markdown

Sorry, @encukou, I could not cleanly backport this to 3.12 due to a conflict.

Please backport manually with cherry_picker, see the devguide for more information.

cherry_picker aa17c688d2c160969f2c8963f4454cdd139808e7 3.12

@bedevere-app

bedevere-app Bot commented Nov 18, 2026

Copy link
Copy Markdown

GH-162210 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 only security fixes label Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs backport to 3.12 only security fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants