capi-workgroup / api-revolution

Proposals for radical or controversial API changes
29 stars 0 forks source link

Context argument #2

Open encukou opened 1 year ago

encukou commented 1 year ago

New API functions should take a "context" as a first argument -- similar to PyThreadState * that a lot of current internal API takes, except opaque.

In the future, this should allow:

Functions that don't take a context argument should those that are safe to use before Python is initialized. (These e.g. PyStatus rather than exception objects for error handling.)

Current API that doesn't do this will need to call PyThreadState_Get before calling the new API.