| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -27,6 +27,38 @@ PyAPI_FUNC(PyObject *) PyContext_CopyCurrent(void); | |
| PyAPI_FUNC(int) PyContext_Enter(PyObject *); | ||
| PyAPI_FUNC(int) PyContext_Exit(PyObject *); | ||
|
|
||
| typedef enum { | ||
| Py_CONTEXT_EVENT_ENTER, | ||
| Py_CONTEXT_EVENT_EXIT, | ||
| } PyContextEvent; | ||
|
|
||
| /* | ||
| * A Callback to clue in non-python contexts impls about a | ||
| * change in the active python context. | ||
| * | ||
| * The callback is invoked with the event and a reference to = | ||
|
Comment thread
Copy link
Copy Markdown
Contributor
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. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityRemove the =, it adds no useful info and is confusing.
Sorry, something went wrong.
erlend-aasland reacted with thumbs up emoji
All reactions
|
||
| * the context after its entered and before its exited. | ||
| * | ||
| * if the callback returns with an exception set, it must return -1. Otherwise | ||
| * it should return 0 | ||
| */ | ||
| typedef int (*PyContext_WatchCallback)(PyContextEvent, PyContext *); | ||
|
|
||
| /* | ||
| * Register a per-interpreter callback that will be invoked for context object | ||
| * enter/exit events. | ||
| * | ||
| * Returns a handle that may be passed to PyContext_ClearWatcher on success, | ||
| * or -1 and sets and error if no more handles are available. | ||
| */ | ||
| PyAPI_FUNC(int) PyContext_AddWatcher(PyContext_WatchCallback callback); | ||
|
|
||
| /* | ||
| * Clear the watcher associated with the watcher_id handle. | ||
| * | ||
| * Returns 0 on success or -1 if no watcher exists for the provided id. | ||
| */ | ||
| PyAPI_FUNC(int) PyContext_ClearWatcher(int watcher_id); | ||
|
|
||
| /* Create a new context variable. | ||
|
|
||
| Expand Down | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Add :c:func:`PyContext_AddWatcher` and :c:func:`PyContext_ClearWatcher` APIs to | ||
| register callbacks to receive notification on enter and exit of context objects. |
| Back | FazBrowse Home | New Git URL |
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityI don't understand this comment, what is meant by clue in? Also what is change in active python context?
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.