-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
gh-116417: Add _testlimitedcapi C extension #116419
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
af160ec
gh-116417: Add _testlimitedcapi C extension
vstinner 29d70e7
Update generate_stdlib_module_names.py
vstinner 0378781
Fix Free Threading build
vstinner 2158b2f
Remove now redundant code
vstinner 116b7a6
Remove redundant code
vstinner b173670
Fix make check-c-globals
vstinner 7fe437f
configure: add _testlimitedcapi test extension
vstinner 838e7dd
Update Modules/Setup.stdlib.in
vstinner 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
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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Test the limited C API. | ||
* | ||
* The 'test_*' functions exported by this module are run as part of the | ||
* standard Python regression test, via Lib/test/test_capi.py. | ||
*/ | ||
|
||
#include "_testlimitedcapi/parts.h" | ||
|
||
static PyMethodDef TestMethods[] = { | ||
{NULL, NULL} /* sentinel */ | ||
}; | ||
|
||
static struct PyModuleDef _testlimitedcapimodule = { | ||
PyModuleDef_HEAD_INIT, | ||
.m_name = "_testlimitedcapi", | ||
.m_size = 0, | ||
.m_methods = TestMethods, | ||
}; | ||
|
||
PyMODINIT_FUNC | ||
PyInit__testlimitedcapi(void) | ||
{ | ||
PyObject *mod = PyModule_Create(&_testlimitedcapimodule); | ||
if (mod == NULL) { | ||
return NULL; | ||
} | ||
|
||
if (_PyTestCapi_Init_VectorcallLimited(mod) < 0) { | ||
return NULL; | ||
} | ||
if (_PyTestCapi_Init_HeaptypeRelative(mod) < 0) { | ||
return NULL; | ||
} | ||
return mod; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#ifndef Py_TESTLIMITEDCAPI_PARTS_H | ||
#define Py_TESTLIMITEDCAPI_PARTS_H | ||
|
||
// Always enable assertions | ||
#undef NDEBUG | ||
|
||
#include "pyconfig.h" // Py_GIL_DISABLED | ||
|
||
// Use the limited C API | ||
#ifndef Py_GIL_DISABLED | ||
# define Py_LIMITED_API 0x030c0000 // 3.12 | ||
#endif | ||
|
||
// Make sure that the internal C API cannot be used. | ||
#undef Py_BUILD_CORE_MODULE | ||
#undef Py_BUILD_CORE_BUILTIN | ||
|
||
#include "Python.h" | ||
|
||
#ifdef Py_BUILD_CORE | ||
# error "Py_BUILD_CORE macro must not be defined" | ||
#endif | ||
|
||
int _PyTestCapi_Init_VectorcallLimited(PyObject *module); | ||
int _PyTestCapi_Init_HeaptypeRelative(PyObject *module); | ||
|
||
#endif // Py_TESTLIMITEDCAPI_PARTS_H |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.