bpo-42064: Pass module state to trace, progress, and authorizer callbacks (GH-27940)

- add print-or-clear traceback helper
- add helpers to clear and visit saved contexts
- modify callbacks to use the new callback_context struct
This commit is contained in:
Erlend Egeberg Aasland 2021-09-07 15:06:17 +02:00 committed by GitHub
parent 8ca6b61e3f
commit 979336de34
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 111 additions and 73 deletions

View file

@ -82,10 +82,10 @@ typedef struct
*/
PyObject* text_factory;
/* remember references to object used in trace_callback/progress_handler/authorizer_cb */
PyObject* function_pinboard_trace_callback;
PyObject* function_pinboard_progress_handler;
PyObject* function_pinboard_authorizer_cb;
// Remember contexts used by the trace, progress, and authoriser callbacks
callback_context *trace_ctx;
callback_context *progress_ctx;
callback_context *authorizer_ctx;
/* Exception objects: borrowed refs. */
PyObject* Warning;