Bug 2005686

Summary: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘use_tracing’; did you mean ‘tracing’?
Product: [Fedora] Fedora Reporter: Ankur Sinha (FranciscoD) <sanjay.ankur>
Component: python3.10Assignee: Python Maintainers <python-maint>
Status: CLOSED CANTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: cstratak, mhroncok, python-maint, python-sig, thrnciar, torsava, vstinner
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-09-23 18:21:46 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ankur Sinha (FranciscoD) 2021-09-19 14:35:08 UTC
Description of problem:

While trying to package numba for Fedora, my builds on rawhide are failing with this error:


  numba/_dispatcher.cpp: In function ‘int call_trace(Py_tracefunc, PyObject*, PyThreadState*, PyFrameObject*, int, PyObject*)’:                     numba/_dispatcher.cpp:28:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘use_tracing’; did you mean ‘tracing’?                    28 |     tstate->use_tracing = 0;                                                                                                                    |             ^~~~~~~~~~~                                                                                                                         |             tracing                                                                                                                       numba/_dispatcher.cpp:30:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘use_tracing’; did you mean ‘tracing’?                    30 |     tstate->use_tracing = ((tstate->c_tracefunc != NULL)                                                                                        |             ^~~~~~~~~~~                                                                                                                         |             tracing                                                                                                                       numba/_dispatcher.cpp: In function ‘PyObject* call_cfunc(Dispatcher*, PyObject*, PyObject*, PyObject*, PyObject*)’:
  numba/_dispatcher.cpp:387:17: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘use_tracing’; did you mean ‘tracing’?
    387 |     if (tstate->use_tracing && tstate->c_profilefunc)
        |                 ^~~~~~~~~~~
        |                 tracing
  numba/_dispatcher.cpp: In function ‘PyObject* Dispatcher_call(Dispatcher*, PyObject*, PyObject*)’:
  numba/_dispatcher.cpp:663:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘use_tracing’; did you mean ‘tracing’?
    663 |     if (ts->use_tracing && ts->c_profilefunc) {
        |             ^~~~~~~~~~~
        |             tracing
  numba/_dispatcher.cpp: In function ‘PyObject* Dispatcher_cuda_call(Dispatcher*, PyObject*, PyObject*)’:
  numba/_dispatcher.cpp:777:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘use_tracing’; did you mean ‘tracing’?
    777 |     if (ts->use_tracing && ts->c_profilefunc) {
        |             ^~~~~~~~~~~
        |             tracing



I found https://bugzilla.redhat.com/show_bug.cgi?id=1958938#c1 and other bugs where this was also seen, and it was noted to be a regression in Python (with a PR for Cython).

I was wondering if this is still the case?

Note that numba currently does not list python 3.10 as supported, so it could just be that it needs updating. But I thought I'd ask :)

Version-Release number of selected component (if applicable):
python3-devel-3.10.0~rc2-2.fc36.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Try building numba package. WIP spec is here https://pagure.io/python-numba/blob/main/f/python-numba.spec
2.
3.

Comment 1 Miro Hrončok 2021-09-19 19:11:47 UTC
Yes, I believe this is a regression in Python, but it will not be fixed in time for Python 3.10. See https://bugs.python.org/issue43760

Unfortunately, numba code needs to be changed :(

Comment 2 Ankur Sinha (FranciscoD) 2021-09-21 15:42:23 UTC
Ah, no worries. We see that there's a PR for getting numba to work with py3.10, and it looks like there's some work needed there too (they've addressed the error I noted above in a commit too). So we'll just wait until they officially support 3.10 and then see how things go.

https://github.com/numba/numba/pull/7381


Please close this bug if you folks don't need it to track the regression.

Cheers,

Comment 3 Victor Stinner 2021-09-23 09:06:43 UTC
I created https://github.com/python/cpython/pull/28527 to document how to update C extensions using PyThreadState.use_tracing: "tstate->use_tracing" must be replaced with "tstate->cframe->use_tracing".

Comment 4 Victor Stinner 2021-09-24 10:11:07 UTC
I'm also working on a new C API to abstract access to PyThreadState: https://github.com/python/cpython/pull/28542