Bug 2246349

Summary: python-pyrsistent fails to build with Python 3.13: implicit declaration of function ‘Py_TRASHCAN_SAFE_BEGIN’, ‘Py_TRASHCAN_SAFE_END’, ‘_PyList_Extend’
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: python-pyrsistentAssignee: Ben Beasley <code>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: code, devrim, ksurma, mhroncok
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-pyrsistent-0.20.0-2.fc40 python-pyrsistent-0.20.0-8.el10_0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-02 12:07:13 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:
Bug Depends On: 2246235    
Bug Blocks: 2244836    

Description Karolina Surma 2023-10-26 10:58:28 UTC
python-pyrsistent fails to build with Python 3.13.0a1.

  pvectorcmodule.c: In function ‘PVector_dealloc’:
  pvectorcmodule.c:235:3: error: implicit declaration of function ‘Py_TRASHCAN_SAFE_BEGIN’; did you mean ‘Py_TRASHCAN_BEGIN’? [-Werror=implicit-function-declaration]
    235 |   Py_TRASHCAN_SAFE_BEGIN(self);
        |   ^~~~~~~~~~~~~~~~~~~~~~
        |   Py_TRASHCAN_BEGIN
  pvectorcmodule.c:241:3: error: implicit declaration of function ‘Py_TRASHCAN_SAFE_END’; did you mean ‘Py_TRASHCAN_END’? [-Werror=implicit-function-declaration]
    241 |   Py_TRASHCAN_SAFE_END(self);
        |   ^~~~~~~~~~~~~~~~~~~~
        |   Py_TRASHCAN_END
  pvectorcmodule.c: In function ‘PVectorEvolver_extend’:
  pvectorcmodule.c:1316:22: error: implicit declaration of function ‘_PyList_Extend’; did you mean ‘PyList_Append’? [-Werror=implicit-function-declaration]
   1316 |   PyObject *retVal = _PyList_Extend((PyListObject *)self->appendList, args);
        |                      ^~~~~~~~~~~~~~
        |                      PyList_Append

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

Remove the old trashcan macros Py_TRASHCAN_SAFE_BEGIN and Py_TRASHCAN_SAFE_END. They should be replaced by the new macros Py_TRASHCAN_BEGIN and Py_TRASHCAN_END. The new macros were added in Python 3.8 and the old macros were deprecated in Python 3.11. (Contributed by Irit Katriel in gh-105111.)


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

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

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 Ben Beasley 2023-10-26 12:41:27 UTC
Fixed upstream in https://github.com/tobgu/pyrsistent/commit/d84cc7e00b02b4508eea23913858efc7279c9803, which was included in yesterday’s 0.20.0 release (bug 2246235).

Comment 2 Ben Beasley 2023-10-26 13:46:00 UTC
While the bug reported here is fixed in:

https://src.fedoraproject.org/rpms/python-pyrsistent/pull-request/7

there is still another problem, as seen in:

https://copr.fedorainfracloud.org/coprs/g/python/python3.13/builds/?dirname=python3.13:pr:7
https://copr.fedorainfracloud.org/coprs/g/python/python3.13/build/6567483/

  pvectorcmodule.c:1316:22: error: implicit declaration of function ‘_PyList_Extend’; did you mean ‘PyList_Append’? [-Werror=implicit-function-declaration]
   1316 |   PyObject *retVal = _PyList_Extend((PyListObject *)self->appendList, args);
        |                      ^~~~~~~~~~~~~~
        |                      PyList_Append
  pvectorcmodule.c:1316:22: warning: initialization of ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
  cc1: some warnings being treated as errors
  command '/usr/bin/gcc' failed with exit code 1

  ********************************************************************************
  WARNING: Could not build the pvectorc extension module.
           Pyrsistent will still work but performance may be degraded.
           The output above this warning shows how the compilation failed.
  ********************************************************************************

I will look into that and see if I can work up a PR to fix the C extension. It’s possible to build pyrsistent without the C extension (I would just need to drop pvectorc from the arguments to %pyproject_save_files), but I don’t want to jump to that right away when the problem is probably straightforward to fix.

Comment 3 Ben Beasley 2023-10-26 14:25:56 UTC
With the addition of https://github.com/tobgu/pyrsistent/pull/284, this is now fixed in https://src.fedoraproject.org/rpms/python-pyrsistent/pull-request/7.

Comment 4 Fedora Update System 2023-11-02 12:05:36 UTC
FEDORA-2023-509f2507ae has been submitted as an update to Fedora 40. https://bodhi.fedoraproject.org/updates/FEDORA-2023-509f2507ae

Comment 5 Fedora Update System 2023-11-02 12:07:13 UTC
FEDORA-2023-509f2507ae has been pushed to the Fedora 40 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 6 Fedora Update System 2024-08-12 22:19:07 UTC
FEDORA-EPEL-2024-330a013802 (python-pyrsistent-0.20.0-8.el10_0) has been submitted as an update to Fedora EPEL 10.0.
https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2024-330a013802

Comment 7 Fedora Update System 2024-08-12 22:24:11 UTC
FEDORA-EPEL-2024-330a013802 (python-pyrsistent-0.20.0-8.el10_0) has been pushed to the Fedora EPEL 10.0 stable repository.
If problem still persists, please make note of it in this bug report.