-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
gh-127124: Change context watcher callback to a callable object #127247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -242,7 +242,7 @@ struct _is { | |
PyObject *audit_hooks; | ||
PyType_WatchCallback type_watchers[TYPE_MAX_WATCHERS]; | ||
PyCode_WatchCallback code_watchers[CODE_MAX_WATCHERS]; | ||
PyContext_WatchCallback context_watchers[CONTEXT_MAX_WATCHERS]; | ||
PyObject *context_watchers[CONTEXT_MAX_WATCHERS]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this need a |
||
// One bit is set for each non-NULL entry in code_watchers | ||
uint8_t active_code_watchers; | ||
uint8_t active_context_watchers; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Changed :c:func:`PyContext_AddWatcher` to take a callable object instead of a C | ||
function pointer so that the callback can have non-global state. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think my preference would be to create a new
contextvars.ContextSwitchedEvent
class that holds the Context object and pass that instead, but this is a smaller change.