Skip to content

gh-127544: Ensure that AF_DECnet is part of socket.AddressFamily, when available #127548

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

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

Conversation

tungol
Copy link
Contributor

@tungol tungol commented Dec 3, 2024

This MR removes the requirement that AddressFamily members are all-uppercase, in order to include AF_DECnet. I added a test to validate that it's part of the enum if the value is present in _socket.

@@ -0,0 +1,2 @@
Ensure that ```AF_DECnet``` is part of the :class:`!socket.AddressFamily`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure why :class:`socket.AddressFamily` didn't work.

Comment on lines 1 to 2
Ensure that ```AF_DECnet``` is part of the :class:`!socket.AddressFamily`
enum, when available.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Ensure that ```AF_DECnet``` is part of the :class:`!socket.AddressFamily`
enum, when available.
Ensure that ``AF_DECnet`` is part of the :class:`!socket.AddressFamily`
enum.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why remove "when available"? It's in an ifdef in socketmodule.c, so CPython already hedges that it might not be present on any given system.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's a bit redundant, and when it's available, it'll appear in AddressFamily, otherwise it won't. If it isn't modified, it seems that it must be in AddressFamily, rather than changing with the os environment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's the opposite of how I'd read it. "when available" at the end meaning "when it's available in the OS environment, ensure that it's part of AddressFamily". Without that, I'd think that "ensure that it's in AddressFamily" means that we always ensure it's in AddressFamily, whether or not it's available from the OS, or that we think it's universally available so not worth mentioning that part.

@tungol
Copy link
Contributor Author

tungol commented Dec 4, 2024

An alternate solution would be to keep isupper but add a special case for the literal "DECnet" alongside that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy