[Solved] How to implement Closure in python using c api? [closed]

I’ve never actually seen PyFunction_SetClosure used, but I would expect to use it for modifying an existing Python function object to change the closure variables. It probably isn’t suitable for implementing a generating a new function with a closure from scratch, because that would not be implemented in terms of PyFunctionObject (since these are specifically … Read more