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-85283: Add PySys_Audit() to the limited C API#108571
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 Aug 28, 2023 • edited by github-actions bot
Loading Uh oh!
There was an error while loading. Please reload this page.
edited by github-actions bot
Uh oh!
There was an error while loading. Please reload this page.
cd4e215 to ee520a1Compareencukou commented Aug 31, 2023
IMO this function is a poor fit for the limited API: it uses varargs, making it difficult to use from non-C languages. See also capi-workgroup/problems#35 |
vstinner commented Aug 31, 2023
The C API has multiple functions using varargs:
Right, they cannot be used in programming languages other than C. But well, C remains widely used, and using this function is relevant in C, no? Which alternative do you propose? PySys_Audit() is related to security and it doesn't get the |
encukou commented Sep 4, 2023
Yup, but they all have alternatives that don't use varargs -- you can use There's no such alternative to |
vstinner commented Sep 4, 2023
I'm not sure that I can follow your rationale. Because there are programming languages which cannot use a C API with variadic arguments, the These programming languages can already build a tuple and call Are you sure that there are programming languages which are used to write Python extensions and cannot use variadic arguments? In C, variadic arguments are very commonly used, by For me, the advantage of adding Note: If there are programming languages which are used to write Python extensions and cannot use variadic arguments, why not letting them to call I think that C and C++ are still commonly used these days to write C extensions for Python. |
encukou commented Sep 4, 2023
No. Those that can use
It was mentioned by @steve-s in capi-workgroup/problems#35 (comment). Should we dig for the rationale?
Yup, C uses them a lot, but e.g. Rust is doing just fine without vararg functions.
As you mentioned, |
vstinner commented Sep 5, 2023
I wrote PR #108965 to add PySys_AuditTuple() to the non-limited C API. Since it's a new API, I would prefer to start by adding it the non-limited C API first, and wait one version to move it the limited C API. Just in case if something goes wrong. |
f1da73b to 8b5bf44Compareencukou commented Sep 7, 2023 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Thank you! |
vstinner commented Sep 13, 2023
Sorry, you want to wait for what? |
encukou commented Sep 18, 2023
I would prefer to wait until both |
This function was added in Python 3.8 by the PEP 578 "Python Runtime Audit Hooks". Add also PySys_AuditTuple() to the limited C API, function added to Python 3.13. Move also non-limited "PerfMap" C API from Include/sysmodule.h to Include/cpython/sysmodule.h.
8b5bf44 to cf09536Comparevstinner commented Oct 17, 2023
Right. I updated my PR to add PySys_Audit() and PySys_AuditTuple() to the limited C API version 3.13 (and so to the stable ABI). |
vstinner commented Oct 17, 2023
Merged. Thanks @encukou for telling me about variadic arguments, the additional of the PySys_AuditTuple() function solves this issue. |
The PySys_Audit() function was added in Python 3.8 by the PEP 578 "Python Runtime Audit Hooks". Add also PySys_AuditTuple() to the limited C API, function added to Python 3.13. Move non-limited "PerfMap" C API from Include/sysmodule.h to Include/cpython/sysmodule.h.
The PySys_Audit() function was added in Python 3.8 by the PEP 578 "Python Runtime Audit Hooks". Add also PySys_AuditTuple() to the limited C API, function added to Python 3.13. Move non-limited "PerfMap" C API from Include/sysmodule.h to Include/cpython/sysmodule.h.
This function was added in Python 3.8 by the PEP 578 "Python Runtime Audit Hooks". It is needed to convert some stdlib extensions to the limited C API, like fcntl, resource and syslog.
Move also non-limited "PerfMap" C API from Include/sysmodule.h to Include/cpython/sysmodule.h.
📚 Documentation preview 📚: https://cpython-previews--108571.org.readthedocs.build/