What is the best way to develop Plone C-Extensions?

Hi everyone,
since a long time already I'm curious about learning and understanding Python C-Extensions, especially in the context of Plone.
While I was already able to develop a small pure Python C-Extension and debugging it with GDB, I was wondering about the best way to do that in Plone.
For example, how would I debug or possibly extend the Acquisition module or the ExtensionClass?
Can anyone share some good practices with me on how to get started in doing so?
Is there anything else you can recommend (besides yogi tea and nerves of steel)?
Thanks in advance!
Ramon

How are C extensions in Plone different from other Python C extensions?
But honestly: why would one want to write Python C extensions voluntarily?
The more modern way (and perhaps less painful way) would be to write the related code in Rust and integrate it with GitHub - PyO3/pyo3: Rust bindings for the Python interpreter . This is the way that Pydantic follows with its new pydantic-core implementation. IMO: a waste of lifetime writing C extensions in 2022, better go with Rust. Getting reference counting in Python on the C level right.... :face_with_spiral_eyes:

Hi Andreas,

thanks for taking the time to answer and sharing the link to the PyO3 GitHub repository.
Regrading your question:

How are C extensions in Plone different from other Python C extensions?

I thought that something like AccessControl or Acquisition can only be tested inside a Zope environment, but probably in the C code you just access the attributes of an object, and this can be all mocked in the tests. So I think I thought to complicated :face_with_spiral_eyes:

Off-topic: Are you using pydantic in Plone add-ons or for other projects?
Thanks for sharing this as well.

Ramon

I am using Pydantic extensively in non-Python projects for almost all more complex data structures - not only in the context of FastAPI, validation of input/output data. I see little use in Plone projects for Pydantic.