Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Avoid file descriptor refleaks in as_file.#234

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
jaraco merged 2 commits intomainfrombugfix/as_file-refleak
Jul 30, 2021

Conversation

@jaraco
Copy link
Member

As reported inpython/cpython#27436 (comment), merging the latest importlib_resources into CPython revealed a refleak. It appears the refleak has long been a part of the implementation but was previously uncovered by the tests. This change fixes that refleak.

@jaracojaraco merged commit64484b7 intomainJul 30, 2021
@jaracojaraco deleted the bugfix/as_file-refleak branchJuly 30, 2021 20:55
@jaracojaraco restored the bugfix/as_file-refleak branchJuly 30, 2021 20:55
@jaracojaraco deleted the bugfix/as_file-refleak branchJuly 30, 2021 20:55
try:
os.remove(raw_path)
except(FileNotFoundError,PermissionError):
exceptFileNotFoundError:
Copy link
Member

@FFY00FFY00Jul 31, 2021
edited
Loading

Choose a reason for hiding this comment

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

Why this part though? IIRC it was added because for some reason Windows will set high permissions on temporary files sometimes.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I believe this exception was masking the underlying issue that the file descriptor wasn't being closed. Windows won't allow deletion of files in use, so when we encountered the issue, we suppressed the exception, allowing the file descriptor to remain unclosed and on Windows leaving the file undeleted. Now that the file descriptor is unconditionally closed, there's no longer any need to suppress this exception and as you can see, tests still pass on Windows.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@FFY00FFY00FFY00 left review comments

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@jaraco@FFY00

[8]ページ先頭

©2009-2025 Movatter.jp