[issue43760] The DISPATCH() macro is not as efficient as it could be (move PyThreadState.use_tracing)

Stefan Behnel report at bugs.python.org
Tue May 11 14:16:10 EDT 2021


Stefan Behnel <stefan_ml at behnel.de> added the comment:

For the same reason that motivated this ticket, I think the functions should be inline functions. They should also take the current thread-state as argument, because that's probably known on the caller side already.

I guess a macro would be fine, too. :)

Cython previously used "use_tracing" directly because it needs to implement the exact same tracing/profiling behaviour as CPython, regardless of who called a Cython implemented function (Cython or CPython).

Naming nit: Get/Is/UsesTracing?

Also, given that a common use case seems to be "make sure tracing is disabled, do something, enable tracing if it was enabled", I think DisableTracing() should return the previous state.

----------
nosy: +scoder

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43760>
_______________________________________


More information about the Python-bugs-list mailing list