-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
bpo-41798: Allocate socket extension module CAPI on the heap #24126
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
Conversation
cc. @tiran / @shihai1991 |
Py_DECREF(m); | ||
return NULL; | ||
} | ||
if (PyModule_AddObject(m, PySocket_CAPI_NAME, capsule) < 0) { |
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.
How about using PyModule_AddObjectRef()
in here?
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.
I think we can leave it as it is for now. We can do a thorough clean up of the module init function when we convert it to multi-phase init. Ok?
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.
No problem.
@@ -342,7 +342,8 @@ typedef struct { | |||
|
|||
*/ | |||
|
|||
/* C API for usage by other Python modules */ | |||
/* C API for usage by other Python modules. | |||
* Always add new things to the end for binary compatibility. */ |
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.
I am not sure this note is correct or not. The binary compatibilty also depends how to use it, no?
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.
You're right. I just copied the comment from the .c file. I figured it made more sense together with the definition in the header file. However, I don't think this comment is really needed. I'd recommend just deleting it.
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.
In case of doubt, I prefer to keep it. It makes sense to only add new members at the end. If a C extension is built with Python 3.10 and a new filed is added to Python 3.11, the Python 3.10 remains ABI compatible. The comment looks correct.
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.
LGTM.
@@ -342,7 +342,8 @@ typedef struct { | |||
|
|||
*/ | |||
|
|||
/* C API for usage by other Python modules */ | |||
/* C API for usage by other Python modules. | |||
* Always add new things to the end for binary compatibility. */ |
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.
In case of doubt, I prefer to keep it. It makes sense to only add new members at the end. If a C extension is built with Python 3.10 and a new filed is added to Python 3.11, the Python 3.10 remains ABI compatible. The comment looks correct.
https://bugs.python.org/issue41798