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

GH-118943: Fix a race condition when generatingjit_stencils.h#118957

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
brandtbucher merged 5 commits intopython:mainfrombrandtbucher:justin-atomic
May 16, 2024

Conversation

@brandtbucher
Copy link
Member

@brandtbucherbrandtbucher commentedMay 11, 2024
edited by bedevere-appbot
Loading

Write to a temporary file first, then rename it to the intendedjit_stencils.h file. This keeps other build steps from assuming that the file has been successfully generated when it's still in the process of being written.

CC:@savannahostrowski

@brandtbucherbrandtbucher added type-bugAn unexpected behavior, bug, or error buildThe build process and cross-build needs backport to 3.13bugs and security fixes labelsMay 11, 2024
@brandtbucherbrandtbucher self-assigned thisMay 11, 2024
Copy link
Member

@savannahostrowskisavannahostrowski left a comment

Choose a reason for hiding this comment

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

Overall, this LGTM. Just one comment.

Copy link
Contributor

@hroncokhroncok left a comment

Choose a reason for hiding this comment

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

The change makes perfect sense and should fix the problem. Hard to test due to the nature of the issue, hence untested.

One question though (and one optional suggestion).

file.write(digest)
ifcomment:
file.write(f"//{comment}\n\n")
file.write("")
Copy link
Contributor

@hroncokhroncokMay 13, 2024
edited
Loading

Choose a reason for hiding this comment

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

Not entirely sure what was the purpose of this line, but it is no longer there. I guess it did nothing, correct?

brandtbucher reacted with thumbs up emoji
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Nice catch. Yeah, I think this was originally intended to write a newline, but it was really doing nothing. But I think wedo want to add a newline whether or not there's a comment, so I'll move one of them from the comment line to here.

file.write(f"{line}\n")
jit_stencils_new.replace(jit_stencils)
finally:
jit_stencils_new.unlink(True)
Copy link
Contributor

Choose a reason for hiding this comment

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

I had to guess (and look up) what the boolean stands for. Would you mind using a keyword argument instead?

Suggested change
jit_stencils_new.unlink(True)
jit_stencils_new.unlink(missing_ok=True)

savannahostrowski reacted with thumbs up emoji
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Yep, good suggestion.

@brandtbucherbrandtbucher merged commit4702b7b intopython:mainMay 16, 2024
@miss-islington-app
Copy link

Thanks@brandtbucher for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestMay 16, 2024
…ythonGH-118957)(cherry picked from commit4702b7b)Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
@bedevere-app
Copy link

GH-119101 is a backport of this pull request to the3.13 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.13bugs and security fixes labelMay 16, 2024
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@savannahostrowskisavannahostrowskisavannahostrowski approved these changes

+1 more reviewer

@hroncokhroncokhroncok approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

@brandtbucherbrandtbucher

Labels

buildThe build process and cross-buildtopic-JITtype-bugAn unexpected behavior, bug, or error

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@brandtbucher@hroncok@savannahostrowski

[8]ページ先頭

©2009-2025 Movatter.jp