Stefan Behnel <stefan...@behnel.de> added the comment:

>From Cython's point of view, the important fields in PyThreadState are the 
>tracing/profiling and exception related ones. We're not using anything else. 
>Users can explicitly opt out of the access to the exception fields by defining 
>a C macro, at the expense of a bit of performance. I doubt that anyone is 
>really doing that, though, because, why would they?

I'm not sure if we could avoid direct field access for profiling and tracing at 
all. You can look at the code, it's a whole bunch of macros that mimic what 
CPython does in ceval:

https://github.com/cython/cython/blob/master/Cython/Utility/Profile.c

I should note that both features are not enabled by default. Users have to 
explicitly enable profiling support via a directive, and even doubly opt in to 
tracing by enabling a compiler directive and a C macro. So production code will 
often not rely on these fields, but developers would want to use them and some 
might keep profiling support enabled also in their production code. My guess is 
that tracing is most often used for test coverage analysis.

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

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35949>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to