-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
add socket.__all__ #13044
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
add socket.__all__ #13044
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
…what should happen here
This comment has been minimized.
This comment has been minimized.
If I've done this correctly, this irons out the errors that are different depending on python version, leaving just the errors that show up for every version of linux.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not comment out any of these constants. They're all defined with IFDEF in CPython and presumably exist somewhere, though I suspect some may exist only on versions of FreeBSD from the mid-1990s compiled while Mars is in retrograde. If you want a rabbit hole to dig into, you could try to figure out exactly where those constants come from (e.g., by digging through CPython git blame or Googling for manpages from the right OS).
stdlib/_socket.pyi
Outdated
SOL_IPX: int | ||
SOL_NETROM: int | ||
SOL_ROSE: int | ||
# if sys.platform != "win32" and sys.platform != "darwin": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not comment these out; they definitely exist on some platforms.
I'll do some more digging on the mystery constants. |
Thanks! To be clear, I don't think it's too important to figure out exactly when these constants exist, and I'd be fine with defining them under |
Okay, that makes sense. In the case of the ones I commented out, I also confirmed that they didn't exist on (my local version of) FreeBSD either. |
Updated, with 7 constants still commented out. 6 of these are linux-only Most of the rest I confirmed are in linux header files to this day, so I restored them to both |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Co-authored-by: Alex Waygood <[email protected]>
@@ -456,6 +497,10 @@ if sys.platform == "linux": | |||
RDS_RDMA_USE_ONCE: int | |||
RDS_RECVERR: int | |||
|
|||
# This is supported by cpython but doesn't seem to be a real thing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# This is supported by cpython but doesn't seem to be a real thing. | |
# This is supported by CPython but doesn't seem to be a real thing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want extra brownie points, you could consider opening an issue at CPython about this ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CPython issue for this constant: python/cpython#127069
NETLINK_XFRM: int | ||
# Technically still supported by cpython |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Technically still supported by cpython | |
# Technically still supported by CPython |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And a CPython issue for these outdated Netlink constants as well: python/cpython#127072
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
I didn't realize there were so many errors being hidden for linux in here when I started. I only have access to MacOS and FreeBSD locally, so I just took the linux pipeline results at mostly face value. In working through all the things that don't exist in the Linux pipeline, I tested against my BSD machine to sort out what was for example,
platform = "win32"
versusplatform != "darwin" and platform != "linux"
orplatform = "darwin" versus "platform != "win32" and platform != "linux"
, etc.When it didn't seem like any system that had a thing, I commented it out in
_socket
and removed it fromsocket
. I expect many of these exist on some linux system somewhere - there's a lot of variance in that space. It seemed like leaving them as a comment in _socket was a good placeholder for now.