Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-60856: Be explicit about localhost for socket.getfqdn #93451

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

slateny
Copy link
Contributor

@slateny slateny commented Jun 3, 2022

@bedevere-bot bedevere-bot added docs Documentation in the Doc dir awaiting review labels Jun 3, 2022
@slateny slateny marked this pull request as draft June 3, 2022 06:25
@slateny
Copy link
Contributor Author

slateny commented Jun 3, 2022

Noticed there's duplicate wording in the last sentence, will change the PR for that

@slateny slateny marked this pull request as ready for review June 3, 2022 06:48
@iritkatriel iritkatriel requested a review from ambv October 4, 2022 22:32
Return a fully qualified domain name for *name*. If *name* is omitted or empty,
it is interpreted as the local host. To find the fully qualified name, the
Return a fully qualified domain name for *name*. If *name* is empty or equal to
``'0.0.0.0'``, the hostname from :func:`gethostname` is returned.
Copy link
Member

Choose a reason for hiding this comment

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

Is it so? Looking at the sources, it tries to return one of names returned by gethostbyaddr(gethostname()).

The new wording also leaves unclear what getfqdn() returns.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The source/behavior was changed in #100375 after this PR was opened, so wording definitely does need updating.

Regarding the unclear new wording, could you expand on that? My interpretation is that previously the entire paragraph needs to be read through before the return of getfqdn(), but now it's right at the top: If *name* is empty ...

Copy link
Member

Choose a reason for hiding this comment

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

Now it starts from the rare corner case (why would anyone pass an empty name to getfqdn()?), but the documentation for getfqdn() without arguments is removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are very correct, leaving out the empty argument is my mistake. What do you think about this instead?

Return a fully qualified domain name for *name*.
To find the fully qualified name, ...
...
... it is returned unchanged.
If *name* is empty, or equal to "0.0.0.0," "::", or "",
the hostname from :func:`gethostname` is returned.

There's also an option of changing getfqdn([name]) to getfqdn(name=''), but not sure if it helps with improving the wording much.

Copy link
Member

Choose a reason for hiding this comment

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

I think that both changing the wording and changing the signature are worth to do.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, let me know if there's anything that looks off. For reference, here's the preview of getfqdn.

*backlog* is the queue size passed to :meth:`socket.listen`; if not specified
, a default reasonable value is chosen.
*backlog* is the queue size passed to :meth:`socket.listen`; if not
specified, a default reasonable value is chosen.
Copy link
Contributor Author

@slateny slateny Mar 3, 2024

Choose a reason for hiding this comment

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

Small formatting fix to remove space before comma for this:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review docs Documentation in the Doc dir skip news
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

3 participants