Uh oh!
There was an error while loading. Please reload this page.
bpo-39947: Add PyThreadState_SetTrace() function - #29121
Conversation
Add new PyThreadState_SetProfile() and PyThreadState_SetTrace() functions to set the profile and the trace function of a Python thread state. * Rename _PyEval_SetProfile() to PyThreadState_SetProfile(). * Rename _PyEval_SetTrace() to PyThreadState_SetTrace(). * Rename is_tstate_valid() to _PyThreadState_CheckConsistency().
vstinner
commented
Oct 21, 2021
PyThreadState_SetProfile() is needed by the Python yappi profiler: Source: https://github.com/sumerc/yappi/blob/8bf7a650066f104f59c3cae4a189ec15e7d51c8c/yappi/_yappi.c#L1258 |
vstinner
commented
Oct 21, 2021
See also discussion at: https://bugs.python.org/issue43760 |
vstinner
commented
Oct 21, 2021
cc @markshannon |
vstinner
commented
Oct 21, 2021
I don't understand well the relationship between |
vstinner
commented
Oct 22, 2021
I'm not sure if yappi can use it directly, since PyThreadState_SetProfile() requires to hold the GIL. But it's more a yappi issue, than an API issue IMO. |
This PR is stale because it has been open for 30 days with no activity. |
| @@ -0,0 +1,3 @@ | |||
| Add new :c:func:`PyThreadState_SetProfile` and | |||
| :c:func:`PyThreadState_SetTrace` functions to set the profile and the trace | |||
There was a problem hiding this comment.
I would add "(replacing _PyEval_SetProfile)" and "(replacing _PyEval_SetTrace)" since those are likely to be the names people have if they are searching for changes, instead of just reading in advance.
There was a problem hiding this comment.
Also mention renaming and move is_tstate_valid to _PyThreadState_CheckConsistency
There was a problem hiding this comment.
is_tstate_valid() is a static function, it cannot be used outside ceval.c. We don't document changes which don't affected the public C API.
There was a problem hiding this comment.
I would add "(replacing _PyEval_SetProfile)" and "(replacing _PyEval_SetTrace)" since those are likely to be the names people have if they are searching for changes, instead of just reading in advance.
Usually, we never mention private functions in the changelog.
vstinner
commented
Feb 3, 2022
If you consider that the doc should be completed, please open a new issue. I don't see a direct relationship between your comment and my PR adding new functions. |
vstinner
commented
Feb 23, 2022
I'm not convinced that there are 3rd party Python projects which need and will use this function. I prefer to close this PR for now. I may revisit it later, if more users of this function are discovered. |
Add new PyThreadState_SetProfile() and PyThreadState_SetTrace()
functions to set the profile and the trace function of a Python
thread state.
https://bugs.python.org/issue39947