-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
gh-86542: New C-APIs to simplify module attribute declaration #23286
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
436c1b0
Define module constants in PyModuleDef
tiran d93f2da
Add PyModule_AddTypeFromSpec
tiran a1c8240
PyModule_AddNew* helpers
tiran a277939
Rename new API to PyModuleConst_
tiran 22e4f7f
Use Py_mod_constants instead of PyModuleDef.m_constants
tiran 31f8189
Revert "Use Py_mod_constants instead of PyModuleDef.m_constants"
tiran 366e810
Remove PyModuleDef.m_constants again
tiran bb41d82
bpo-42376: New C-APIs to simplify module attribute declaration
tiran 751c560
ULong, private types, add module to call
tiran c34a4df
Add CAPI tests
tiran 3e50f44
Typo
tiran 00236fe
Use single base class feature from bpo-42423
tiran 8458120
It's a strong ref
tiran File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Remove PyModuleDef.m_constants again
- Loading branch information
commit 366e810efce0a95c40bf089d2068ee64ebc8feeb
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15687,7 +15687,7 @@ posixmodule_exec(PyObject *m) | |
return 0; | ||
} | ||
|
||
static PyModuleConst_Def _posix_constants[] = { | ||
static PyModuleConst_Def posix_constants[] = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about using another sepeareted PR to do this converation operation? |
||
#ifdef F_OK | ||
PyModuleConst_LongMacro(F_OK), | ||
#endif | ||
|
@@ -15769,9 +15769,16 @@ static PyModuleConst_Def _posix_constants[] = { | |
{NULL, 0}, | ||
}; | ||
|
||
static int | ||
posixmodule_init_constants(PyObject *module) | ||
{ | ||
return PyModule_AddConstants(module, posix_constants); | ||
} | ||
|
||
|
||
static PyModuleDef_Slot posixmodile_slots[] = { | ||
{Py_mod_exec, posixmodule_exec}, | ||
{Py_mod_exec, posixmodule_init_constants}, | ||
{0, NULL} | ||
}; | ||
|
||
|
@@ -15785,7 +15792,6 @@ static struct PyModuleDef posixmodule = { | |
.m_traverse = _posix_traverse, | ||
.m_clear = _posix_clear, | ||
.m_free = _posix_free, | ||
.m_constants = _posix_constants, | ||
}; | ||
|
||
PyMODINIT_FUNC | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
nitpick:
static PyObject *
in here.