-
-
Notifications
You must be signed in to change notification settings - Fork 51
c api next level manifesto
Simon Cross edited this page Nov 17, 2020
·
5 revisions
Python's C extension API has historically been one of it's strengths. A huge ecosystem of high-performance scientific and numerical software has been built on top of it. It got us this far, but now it's holding us back. It's time to take it to the next level.
- Don't return borrowed references.
- Don't steal references.
- Don't expose reference counting as part of the API.
- Don't rely on pointers for object identity.
- Don't expose the memory layout of Python objects as part of the API.
- Expose Python (the language), not a specific Python implementation version.
- Expose constructs generally useful in C, not constructs specific to a Python implementation version.
- Provide an explicit execution context.
All abstractions leak, but the current C API leaks like a sieve!
- The existing ecosystem of C extensions should continue to work.
- Performance of existing C extensions run on CPython should be no worse.
- There should be a sensible migration path for big C extensions (e.g. numpy).
- There should be a way to easily pick up common errors introduced by migrating.
In short, we should avoid making the lives of maintainers and users of C extensions difficult.
Excitingly, we believe all of these goals are achievable within the constraints. We're currently working on one way to achieve them and we'd love input and feedback and wecome contributions of all kinds!
- 5 September 2024
- 4 April 2024
- 7 March 2024
- 1 February 2024
- 11 January 2024
- 7 December 2023
- 9 November 2023
- 5 October 2023
- 14 September 2023
- 3 August 2023
- 6 July 2023
- 1 June 2023
- 4 May 2023
- 13 April 2023
- 2 March 2023
- 2 February 2023
- 12 January 2023
- 1 December 2022
- 3 November 2022
- 6 October 2022
- 8 September 2022
- 4 August 2022
- 7 July 2022
- 2 June 2022
- 5 May 2022
- 7 April 2022
- 3 March 2022
- 3 February 2022
- 13 January 2022
- 2 December 2021
- 4 November 2021
- 7 October 2021
- 2 September 2021
- 12 August 2021
- 8 July 2021
- 6 May 2021
- 4 March 2021
- 7 January 2021
- 3 December 2020
- 5 November 2020