-
-
Notifications
You must be signed in to change notification settings - Fork 32k
<
8000
div class="d-flex flex-column flex-md-row flex-items-start flex-md-items-center">
gh-95991: Add some infrastructure for testing Limited API in _testcapi #95992
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
encukou
merged 5 commits into
python:main
from
encukou:skip-limited-tests-for-tracerefs
Aug 17, 2022
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
368e434
gh-95991: Add some infrastructure for testing Limited API in _testcapi
encukou df49186
Remove repeated #undef NDEBU
encukou 4b946d4
Update Lib/test/support/__init__.py
encukou b3b50c0
Document requires_limited_api
encukou ee59cb3
Force a dependency on python3.dll in the Windows build
encukou 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
Next
Next commit
gh-95991: Add some infrastructure for testing Limited API in _testcapi
- Limited API needs to be enabled per source file - Some builds don't support Limited API, so Limited API tests must be skipped on those builds (currently this is `Py_TRACE_REFS`, but that may change.) - `Py_LIMITED_API` must be defined before `<Python.h>` is included. This puts the hoop-jumping in `testcapi/parts.h`, so individual test files can be relatively simple. (Currently that's only `vectorcall_limited.c`, imagine more.)
- Loading branch information
commit 368e434e595b39a1efdb42ab1f06af70e25181fe
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,39 @@ | ||
#ifndef Py_TESTCAPI_PARTS_H | ||
#define Py_TESTCAPI_PARTS_H | ||
|
||
#include "pyconfig.h" // for Py_TRACE_REFS | ||
|
||
// Figure out if Limited API is available for this build. If it isn't we won't | ||
// build tests for it. | ||
// Currently, only Py_TRACE_REFS disables Limited API. | ||
#ifdef Py_TRACE_REFS | ||
#undef LIMITED_API_AVAILABLE | ||
#else | ||
#define LIMITED_API_AVAILABLE 1 | ||
erlend-aasland marked this conversation as resolved.
Show resolved
Hide resolved
|
||
#endif | ||
|
||
// Always enable assertions | ||
#undef NDEBUG | ||
|
||
#if !defined(LIMITED_API_AVAILABLE) && defined(Py_LIMITED_API) | ||
// Limited API being unavailable means that with Py_LIMITED_API defined | ||
// we can't even include Python.h. | ||
// Do nothing; the .c file that defined Py_LIMITED_API should also do nothing. | ||
|
||
#else | ||
|
||
#include "Python.h" | ||
|
||
/* Always enable assertions */ | ||
#undef NDEBUG | ||
|
||
int _PyTestCapi_Init_Vectorcall(PyObject *module); | ||
int _PyTestCapi_Init_VectorcallLimited(PyObject *module); | ||
int _PyTestCapi_Init_Heaptype(PyObject *module); | ||
int _PyTestCapi_Init_Unicode(PyObject *module); | ||
|
||
#ifdef LIMITED_API_AVAILABLE | ||
int _PyTestCapi_Init_VectorcallLimited(PyObject *module); | ||
#endif // LIMITED_API_AVAILABLE | ||
|
||
#endif | ||
#endif // Py_TESTCAPI_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
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.
Uh oh!
There was an error while loading. Please reload this page.