Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
vstinner commented Mar 6, 2024 • edited by bedevere-app bot
Loading Uh oh!
There was an error while loading. Please reload this page.
edited by bedevere-app bot
Uh oh!
There was an error while loading. Please reload this page.
Add a new C extension "_testlimitedcapi" which is only built with the limited C API. Move heaptype_relative.c and vectorcall_limited.c from Modules/_testcapi/ to Modules/_testlimitedcapi/.
vstinner commented Mar 6, 2024
@erlend-aasland@encukou@sobolevn@colesbury: What do you think of this change? (See the issue for the rationale.) |
vstinner commented Mar 6, 2024
If we land this change, should we move tests which don't use the non-limited C API (tests only using the limited C API) to _testlimitedapi? This change should be backported to 3.11 and 3.12 branches to ease backport of future changes. |
colesbury left a comment
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 seems like a good idea to me.
- The
#include "pyconfig.h"can be removed fromvectorcall_limited.candheaptype_relative.cnow that it's part ofparts.h heaptype_relative.ccan also remove thePy_LIMITED_APIdefine now that it's defined inparts.h.
Uh oh!
There was an error while loading. Please reload this page.
zooba commented Mar 6, 2024
Can we remove |
vstinner commented Mar 6, 2024
Fixed: nicely spotted for remaining code in heaptype_relative.c. I had a lot of build issues to build the new C extension properly on Linux and Windows, and then I forgot these lines.
I don't think that it's a test, but more an example to write code using the limited C API. I started with the comment: /*Usethisfileasatemplatetostartimplementingamodulethatalsodeclaresobjecttypes. Alloccurrencesof 'Xxo' should be changedcc @encukou |
vstinner commented Mar 7, 2024
@colesbury: I addressed your remarks and tests now pass. You can review the updated PR ;-) |
colesbury left a comment
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
sobolevn left a comment
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 looks like a good idea, thank you!
erlend-aasland left a comment
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'd like it if you could create an entry for this module in configure.ac; that way it is easier to see if this module is enabled or not. Relevant output from sample ./configure and make invocations:
The following modules are *disabled* in configure script: _ctypes_test _testbuffer _testcapi _testclinic _testclinic_limited _testexternalinspection _testimportmultiple _testinternalcapi _testmultiphase _testsinglephase _xxtestfuzz xxsubtype checking for stdlib extension module _testcapi... disabled checking for stdlib extension module _testclinic... disabled checking for stdlib extension module _testclinic_limited... disabled checking for stdlib extension module _testinternalcapi... disabled checking for stdlib extension module _testbuffer... disabled checking for stdlib extension module _testimportmultiple... disabled checking for stdlib extension module _testmultiphase... disabled checking for stdlib extension module _testsinglephase... disabled checking for stdlib extension module _testexternalinspection... disabled If you "hide" this new extension module behind the _testcapi module, it will not show up in these outputs.
vstinner commented Mar 7, 2024
Sure! It's done. Example: The test extension is now disabled as expected. |
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Erlend E. Aasland <[email protected]>
erlend-aasland commented Mar 7, 2024
Thanks! On more nit :) |
erlend-aasland commented Mar 7, 2024
It's a nice change; it makes sense to have this as a separate test module IMO. |
vstinner commented Mar 7, 2024
Thanks for your helpful reviews! I merged my PR. |
vstinner commented Mar 7, 2024
Backporting this change to Python 3.12 looks non trivial, I get many conflicts: The split of |
Add a new C extension "_testlimitedcapi" which is only built with the limited C API. Move heaptype_relative.c and vectorcall_limited.c from Modules/_testcapi/ to Modules/_testlimitedcapi/. * configure: add _testlimitedcapi test extension. * Update generate_stdlib_module_names.py. * Update make check-c-globals. Co-authored-by: Erlend E. Aasland <[email protected]>
Add a new C extension "_testlimitedcapi" which is only built with the limited C API. Move heaptype_relative.c and vectorcall_limited.c from Modules/_testcapi/ to Modules/_testlimitedcapi/. * configure: add _testlimitedcapi test extension. * Update generate_stdlib_module_names.py. * Update make check-c-globals. Co-authored-by: Erlend E. Aasland <[email protected]>
Add a new C extension "_testlimitedcapi" which is only built with the limited C API.
Move heaptype_relative.c and vectorcall_limited.c from Modules/_testcapi/ to Modules/_testlimitedcapi/.