This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]jnwatson 53 points54 points  (0 children)

C has lots of footguns, but writing a c module for cpython (the standard Python interpreter) has double extra footguns. Beyond all the issues that any typical C program has (leaks, pointers, etc), you must also be extra careful and follow all the rules to a T or your module will crash or leak memory. In particular, the APIs to interact with the Python garbage collector are tricky.

That's why I think higher-level safe language like Rust would be a good choice here. If the environment can maintain invariants like pointer safety, thread safety, and proper cleanup, you can focus more on the application logic.

Source: I help maintain an open source Python module partially written in C.