Bug 2264230 - renderdoc fails to build with Python 3.13: error: ‘_PyNone_Type’ was not declared in this scope; did you mean ‘PyLong_Type’
Summary: renderdoc fails to build with Python 3.13: error: ‘_PyNone_Type’ was not decl...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: renderdoc
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: kb1000
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.13
TreeView+ depends on / blocked
 
Reported: 2024-02-14 17:15 UTC by Karolina Surma
Modified: 2024-03-29 17:33 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2024-03-29 17:33:09 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Karolina Surma 2024-02-14 17:15:57 UTC
renderdoc fails to build with Python 3.13.0a3.

/builddir/build/BUILD/renderdoc-1.31/redhat-linux-build/qrenderdoc/renderdoc_python.cxx: In function ‘PyObject* RENDERDOC_DumpObject(PyObject*)’:
/builddir/build/BUILD/renderdoc-1.31/redhat-linux-build/qrenderdoc/renderdoc_python.cxx:284466:43: error: ‘_PyNone_Type’ was not declared in this scope; did you mean ‘PyLong_Type’?
284466 |      PyObject_IsInstance(obj, (PyObject*)&_PyNone_Type) ||
       |                                           ^~~~~~~~~~~~
       |                                           PyLong_Type
renderdoc_python.cxx: In function ‘PyObject* RENDERDOC_DumpObject(PyObject*)’:
renderdoc_python.cxx:284466:43: error: ‘_PyNone_Type’ was not declared in this scope; did you mean ‘PyLong_Type’?
284466 |      PyObject_IsInstance(obj, (PyObject*)&_PyNone_Type) ||
       |                                           ^~~~~~~~~~~~
       |                                           PyLong_Type

https://docs.python.org/3.13/whatsnew/3.13.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.13/fedora-rawhide-x86_64/07015467-renderdoc/

For all our attempts to build renderdoc with Python 3.13, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.13/package/renderdoc/

Testing and mass rebuild of packages is happening in copr.
You can follow these instructions to test locally in mock if your package builds with Python 3.13:
https://copr.fedorainfracloud.org/coprs/g/python/python3.13/

Let us know here if you have any questions.

Python 3.13 is planned to be included in Fedora 41.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.13.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires),
so if this package is required a lot, it's important for us to get it fixed soon.

We'd appreciate help from the people who know this package best,
but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Miro Hrončok 2024-02-15 08:11:41 UTC
https://docs.python.org/3.13/c-api/none.html says:

Note that the PyTypeObject for None is not directly exposed in the Python/C API. Since None is a singleton, testing for object identity (using == in C) is sufficient. 

Hence this check:

    PyObject_IsInstance(obj, (PyObject*)&_PyNone_Type)

Should probably be replaced with:

    obj == Py_None

Comment 2 kb1000 2024-02-16 23:22:38 UTC
I'm looking into this, and after patching that I can see some additional errors:

compiling ../../qrenderdoc/Code/pyrenderdoc/PythonContext.cpp
../../qrenderdoc/Code/pyrenderdoc/PythonContext.cpp: In static member function ‘static void PythonContext::GlobalInit()’:
../../qrenderdoc/Code/pyrenderdoc/PythonContext.cpp:274:3: error: ‘Py_SetProgramName’ was not declared in this scope; did you mean ‘Py_GetProgramName’?
  274 |   Py_SetProgramName(program_name);
      |   ^~~~~~~~~~~~~~~~~
      |   Py_GetProgramName
../../qrenderdoc/Code/pyrenderdoc/PythonContext.cpp:280:3: error: ‘PyEval_InitThreads’ was not declared in this scope; did you mean ‘PyEval_SaveThread’?
  280 |   PyEval_InitThreads();
      |   ^~~~~~~~~~~~~~~~~~
      |   PyEval_SaveThread

This would require switching from Py_Initialize to Py_InitializeFromConfig, which was introduced in Python 3.8 while upstream still supports and uses Python 3.6.
I'm not sure yet if that's all issues, but I think so.

Comment 3 kb1000 2024-03-29 17:33:09 UTC
Seeing https://copr.fedorainfracloud.org/coprs/g/python/python3.13/build/7232827/, this is fixed now.


Note You need to log in before you can comment on or make changes to this bug.