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

bpo-46315: Use fopencookie() to avoid dup() in _PyTokenizer_FindEncodingFilename#32033

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
tiran merged 4 commits intopython:mainfromtiran:bpo-46315-fdopencookie
Mar 22, 2022

Conversation

tiran
Copy link
Member

@tirantiran commentedMar 21, 2022
edited by bedevere-bot
Loading

@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by@pablogsal for commit6be12fc 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

@bedevere-botbedevere-bot removed the 🔨 test-with-buildbotsTest PR w/ buildbots; report in status section labelMar 21, 2022
// cookie is just the fd
borrowed b;
b.fd = fd;
return fopencookie(b.cookie, "r", cookie_io);
Copy link
Member

Choose a reason for hiding this comment

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

fopencookie is a non-standard GNU extension. Is this available in all platforms targetted by web assembly? Does this need a configure check?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I had a configure check in my first version of the patch. I got rid of it because it makes no sense. Both WASI and Emscripten use musl libc as upper half of libc and it always provides fdopencookie.

I wish their was a more elegant way to solve the problem._PyTokenizer_FindEncodingFilename uses a FILE pointer instead of a file descriptor.

Copy link
Member

Choose a reason for hiding this comment

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

Ugh, I am honestly not very happy with the amount of extra code, but I understand why is needed.

@tiran
Copy link
MemberAuthor

The failing tests on macOS ARM64 and FreeBSD are unrelated to my changes.

Copy link
Member

@pablogsalpablogsal left a comment

Choose a reason for hiding this comment

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

The code looks good to me, but I had no way to test it myself, so I am not formally approving. Feel free to land if you want though

@tirantiran changed the titlebpo-46315: Use fdopencookie() to avoid dup() in _PyTokenizer_FindEncodingFilenamebpo-46315: Use fopencookie() to avoid dup() in _PyTokenizer_FindEncodingFilenameMar 22, 2022
@tiran
Copy link
MemberAuthor

I can shorten the code.fopencookie handles NULL function pointers correctly. Our code only needs a read callback.

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

@pablogsalpablogsalpablogsal left review comments

@lysnikolaoulysnikolaouAwaiting requested review from lysnikolaoulysnikolaou is a code owner

Assignees
No one assigned
Labels
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@tiran@bedevere-bot@pablogsal@the-knights-who-say-ni

[8]ページ先頭

©2009-2025 Movatter.jp