Skip to content

Frame removed in PyThreadState() starting Python 3.11 #326

@dfateyev

Description

@dfateyev

The apsw package fails to build under Python 3.11.0a4, with an error: PyThreadState {aka struct _ts} has no member named frame.
The maintainers may be interested in switching to PyThreadState_GetFrame() which is available from Python 3.9 onward.

src/traceback.c: In function ‘AddTraceBackHere’:
src/traceback.c:86:7: warning: passing argument 14 of ‘PyCode_New’ makes pointer from integer without a cast [-Wint-conversion]
   86 |       lineno,      /*int firstlineno,*/
      |       ^~~~~~
      |       |
      |       int
In file included from /usr/include/python3.11/code.h:13,
                 from /usr/include/python3.11/Python.h:69,
                 from src/apsw.c:75:
/usr/include/python3.11/cpython/code.h:156:33: note: expected ‘PyObject *’ {aka ‘struct _object *’} but argument is of type ‘int’
  156 |         PyObject *, PyObject *, PyObject *, int, PyObject *,
      |                                 ^~~~~~~~~~
src/traceback.c:87:7: warning: passing argument 15 of ‘PyCode_New’ makes integer from pointer without a cast [-Wint-conversion]
   87 |       empty_code   /*PyObject *lnotab*/
      |       ^~~~~~~~~~
      |       |
      |       PyObject * {aka struct _object *}
/usr/include/python3.11/cpython/code.h:156:45: note: expected ‘int’ but argument is of type ‘PyObject *’ {aka ‘struct _object *’}
  156 |         PyObject *, PyObject *, PyObject *, int, PyObject *,
      |                                             ^~~
src/traceback.c:70:10: error: too few arguments to function ‘PyCode_New’
   70 |   code = PyCode_New(
      |          ^~~~~~~~~~
/usr/include/python3.11/cpython/code.h:153:28: note: declared here
  153 | PyAPI_FUNC(PyCodeObject *) PyCode_New(
      |                            ^~~~~~~~~~
In file included from src/apsw.c:137:
src/pyutil.c: In function ‘Call_PythonMethod’:
src/pyutil.c:177:3: warning: ‘PyEval_CallObjectWithKeywords’ is deprecated [-Wdeprecated-declarations]
  177 |   res = PyEval_CallObject(method, args);
      |   ^~~
In file included from /usr/include/python3.11/Python.h:93:
/usr/include/python3.11/ceval.h:27:43: note: declared here
   27 | Py_DEPRECATED(3.9) PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords(
      |                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/apsw.c:143:
src/util.c: In function ‘apsw_write_unraiseable’:
src/util.c:123:32: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘frame’; did you mean ‘cframe’?
  123 |   frame = PyThreadState_GET()->frame;
      |                                ^~~~~
      |                                cframe
...

Changes of the PyThreadState structure members:

  • frame: removed, use PyThreadState_GetFrame() (function added to Python 3.9 by bpo-40429). Warning: the function returns a strong reference, need to call Py_XDECREF().

https://bugs.python.org/issue40429
https://docs.python.org/3.11/whatsnew/3.11.html

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions