GeezerVison is showing github.com — [C API] Move private PyCode and PyOptimizer API to the internal C API · Issue #120642 · python/cpython
[C API] Move private PyCode and PyOptimizer API to the internal C API #120642DescriptionThe private PyCode and PyOptimizer APIs use "unnamed structs/unions" which are not allowed in ISO C99: see #120293.
I propose to move private PyCode and PyOptimizer APIs to the internal C API.
6 PyUnstable optimizer functions are moved to the internal C API:
- PyUnstable_Replace_Executor()
- PyUnstable_SetOptimizer()
- PyUnstable_GetOptimizer()
- PyUnstable_GetExecutor()
- PyUnstable_Optimizer_NewCounter()
- PyUnstable_Optimizer_NewUOpOptimizer()
Linked PRs
Activityronaldoussoren commented on Jun 17, 2024 These functions were added in #104584, and may be intended as an API used by other JITs as well (possibly with some changes). vstinner commented on Jun 17, 2024
These functions were added in #104584, and may be intended as an API used by other JITs as well (possibly with some changes).
These functions are still exported, but the few other JITs would have to update their code to include pycore_optimizer.h. Is it ok? ronaldoussoren commented on Jun 19, 2024
These functions were added in #104584, and may be intended as an API used by other JITs as well (possibly with some changes).
These functions are still exported, but the few other JITs would have to update their code to include pycore_optimizer.h. Is it ok?
I don't know. @markshannon added these function and may have an opinion on this. vstinner commented on Jun 20, 2024 @iritkatriel @brandtbucher @Fidget-Spinner: Do you know anyone using these unstable functions outside Python itself? They were added to Python 3.13. I propose to move them to <pycore_optimizer.h>. In short, are you ok with #120643 ?
I prefer to move private APIs to the internal C API, and the API is causing C99 compatibility issues in strict mode (pedantic). Fidget-Spinner commented on Jun 20, 2024 From what I am aware of, I don't know anyone using these APIs outside of Python itself. However, they are meant to be used as unstable APIs, so not sure where they are supposed to go normally? markshannon commented on Jun 20, 2024 I think it is fine to remove them, as no one is using this API.
If there is interest in the future for plug in optimizers, we would probably want to offer a quite different API that allowed plugins to add additional passes, rather replace the whole of tier 2. vstinner commented on Jun 20, 2024
I think it is fine to remove them, as no one is using this API.
Oh ok. I updated my PR to remove the 6 PyUnstable functions from the public C API. Most of them have to be kept for tests, but I renamed them and moved them to the internal C API.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|