Bug 2246291

Summary: cryptlib fails to build with Python 3.13: error: implicit declaration of function ‘PyObject_AsWriteBuffer’, ‘PyObject_AsCharBuffer’
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: cryptlibAssignee: Ralf Senderek <innovation>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: innovation, ksurma, mhroncok
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: 2023-11-06 15:25:30 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:    
Bug Blocks: 2244836    

Description Karolina Surma 2023-10-26 07:48:10 UTC
cryptlib fails to build with Python 3.13.0a1.

python.c: In function ‘getPointerWrite’:
python.c:23:9: error: implicit declaration of function ‘PyObject_AsWriteBuffer’; did you mean ‘PyObject_GetBuffer’? [-Werror=implicit-function-declaration]
   23 |     if (PyObject_AsWriteBuffer(objPtr, (void **)bytesPtrPtr, &size) == -1)
      |         ^~~~~~~~~~~~~~~~~~~~~~
      |         PyObject_GetBuffer
python.c: In function ‘getPointerRead’:
python.c:47:13: error: implicit declaration of function ‘PyObject_AsCharBuffer’; did you mean ‘PyObject_CheckBuffer’? [-Werror=implicit-function-declaration]
   47 |         if (PyObject_AsCharBuffer(objPtr, (const char **)bytesPtrPtr, &size) == -1)
      |             ^~~~~~~~~~~~~~~~~~~~~
      |             PyObject_CheckBuffer


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/06546751-cryptlib/

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

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 Ralf Senderek 2023-11-01 15:08:11 UTC
I have updated the source code to Cryptlib version 3.4.7-1 in RAWHIDE.

The source code of python.c is now based entirely on the new Buffer Protocol using  PyObject_GetBuffer() only.
The offending old wrapper functions PyObject_AsWriteBuffer() and PyObject_AsCharBuffer() are deleted 
everywhere. All my tests of python code that uses the new Cryptlib python library show that the changed
code is fully functional.

A new Cryptlib version has been build for RAWHIDE : https://bodhi.fedoraproject.org/updates/FEDORA-2023-5c1e41b85c

Please check if the 3.4.7-1 build in RAWHIDE  builds with Python 3.13.0a1 in copr and if so, 
please close this bug.

Thanks.