Skip to content

gh-123797: Check for runtime availability of ptsname_r on macos - #123806

Merged
sobolevn merged 4 commits into
python:mainfrom
sobolevn:issue-123797
Sep 20, 2024
Merged

gh-123797: Check for runtime availability of ptsname_r on macos#123806
sobolevn merged 4 commits into
python:mainfrom
sobolevn:issue-123797

Conversation

@sobolevn

@sobolevnsobolevn commented Sep 7, 2024

Copy link
Copy Markdown
Member

@Eclips4Eclips4 added the needs backport to 3.13 bugs and security fixes label Sep 7, 2024
Comment threadModules/posixmodule.c Outdated
Comment threadModules/posixmodule.c Outdated
Comment on lines +8684 to +8687
#else
// unknown error:
// both ptsname_r and ptsname are not available for some reason.
ret = -1;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a "cannot happen" case: ptsname is available on all versions of macOS where configure detects ptsname_r.

I'd either drop drop the guard for the block above or replace this bit by an #error.

(And regardless ret = -1 is wrong, the value should be an errno value such as ENOSYS).

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Done, thanks for the review! 👍

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.

This is a "cannot happen" case: ptsname is available on all versions of macOS where configure detects ptsname_r.

Is there a macOS or iOS platform where ptsname() and ptsname_r() are not available?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a macOS or iOS platform where ptsname() and ptsname_r() are not available?
In short, no.

ptsname_r() is available on macOS 10.13.4 and iOS 11.3 (and later), ptsname() has been available from the start. Or at least, there are no availability annotations in Apple's headers which is a good indication that the API was available from the start.

@bedevere-app

Copy link
Copy Markdown

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

Comment threadModules/posixmodule.c Outdated
Comment threadModules/posixmodule.c
Comment threadModules/posixmodule.c Outdated
@sobolevn

sobolevn commented Sep 10, 2024

Copy link
Copy Markdown
MemberAuthor

Done, thanks a lot, @vstinner, for the helpful suggestions! 👍

@vstinnervstinner left a comment

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.

LGTM

@sobolevn

Copy link
Copy Markdown
MemberAuthor

I will wait for @ronaldoussoren's feedback for a ~week and then merge 👍

@sobolevn

Copy link
Copy Markdown
MemberAuthor

One week has passed (why the time is so fast?), so I am merging this.
Thanks to @vstinner and @ronaldoussoren for the reviews!

@sobolevn
sobolevn merged commit 3e36e5a into python:mainSep 20, 2024
@miss-islington-app

Copy link
Copy Markdown

Thanks @sobolevn 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 request Sep 20, 2024
…os (pythonGH-123806)
(cherry picked from commit 3e36e5a)
Co-authored-by: sobolevn <mail@sobolevn.me>
@bedevere-app

Copy link
Copy Markdown

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

savannahostrowski pushed a commit to savannahostrowski/cpython that referenced this pull request Sep 22, 2024
savannahostrowski pushed a commit to savannahostrowski/cpython that referenced this pull request Sep 22, 2024
Yhg1s pushed a commit that referenced this pull request Sep 30, 2024
…cos (GH-123806) (#124270)
gh-123797: Check for runtime availability of `ptsname_r` on macos (GH-123806)
(cherry picked from commit 3e36e5a)
Co-authored-by: sobolevn <mail@sobolevn.me>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@sobolevn@vstinner@ronaldoussoren@Eclips4