Since Python 3.4, once can replace easily the Python memory allocators via the C API with its own copy (https://docs.python.org/3/c-api/memory.html#customize-memory-allocators).
This is a great feature for implementing performance optimizations or profiling. This has given the ability to build powerful tools such as tracemalloc!
However, there's one cruelly missing feature.
The API only gives you access to the number of bytes to allocate and later to the pointer to free. It would be really useful to have more context about the allocation itself. For example, one piece of information that would be really useful is to have the type that is being allocated. This would allow profilers, such as tracemalloc, to get more information about the allocated type, and not only a number of bytes in order to help debugging or building statistics.
I doubt this is currently doable without changing or adding a new C API unfortunately.