Another example is that Cython currently calls PyCode_New() to create
a fake frame object with a filename and line number. IMO it's the
wrong abstraction level: Python should provide a function to create a
frame with a filename and line number, so the caller doesn't have to
bother about the complex PyCode_New() API and frequent PyCodeObject
changes. (Correct me if this problem has already been solved in
That was solved quite a while ago, with the PyCode_NewEmpty() API. Sadly Cython doesn't call it (or at least not always), because it takes a C string which is turned into a unicode object, and Cython already has the unicode object in hand. I don't want to proliferate APIs.