Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1900688

Summary: python-mapnik fails to build with Python 3.10: Avoid using PyObject_AsCharBuffer(), PyObject_AsReadBuffer() and PyObject_AsWriteBuffer()
Product: [Fedora] Fedora Reporter: Tomáš Hrnčiar <thrnciar>
Component: python-mapnikAssignee: Tom Hughes <tom>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: mhroncok, thrnciar, tom
Target Milestone: ---Keywords: Reopened
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: 2020-11-23 20:22:05 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: 1890881    

Description Tomáš Hrnčiar 2020-11-23 14:26:32 UTC
python-mapnik fails to build with Python 3.10.0a2.

src/mapnik_image.cpp:260:9: error: ‘PyObject_AsReadBuffer’ was not declared in this scope; did you mean ‘PyObject_GetBuffer’?
  260 |     if (PyObject_AsReadBuffer(obj, &buffer, &buffer_len) == 0)
      |         ^~~~~~~~~~~~~~~~~~~~~
      |         PyObject_GetBuffer
error: command '/usr/bin/c++' failed with exit code 1
error: Bad exit status from /var/tmp/rpm-tmp.oJCDrx (%build)
    Bad exit status from /var/tmp/rpm-tmp.oJCDrx (%build)

https://docs.python.org/3.10/whatsnew/changelog.html#id16

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.10/fedora-rawhide-x86_64/01772812-python-mapnik/

For all our attempts to build python-mapnik with Python 3.10, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/package/python-mapnik/

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.10:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/

Let us know here if you have any questions.

Python 3.10 will be included in Fedora 35. To make that update smoother, we're building Fedora packages with early pre-releases of Python 3.10.
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 Tom Hughes 2020-11-23 14:42:04 UTC
If you build in COPR you get to pickup the pieces. Come back when you gave a koji side tag.

Comment 2 Tomáš Hrnčiar 2020-11-23 15:11:16 UTC
We are already testing all packages with upcoming Python 3.10, which will be part of Fedora 35. This change was already accepted https://fedoraproject.org/wiki/Changes/Python3.10.
Please don't close this bug before it's fixed. We are tracking all packages that will break with Python 3.10.

Comment 3 Tom Hughes 2020-11-23 16:18:31 UTC
If python 3.10 is not in rawhide yet, or even in a side tag where I can build against it then this cannot possibly be a valid bug against rawhide.

Comment 4 Miro Hrončok 2020-11-23 18:24:16 UTC
Tom, "something will break in the future" is certainly a valid bug. I understand that it might not be a big priority for you at this moment, but closing it is not helpful.

Python 3.10 is an approved future of Fedora. We are doing our best to avoid breakage before it actually happens. If we only reported (and fixed) bugs once there is a Koji side tag, we would not have time to fix everything in time.

You can build against Python 3.10 using mock.

Comment 5 Tom Hughes 2020-11-23 19:01:42 UTC
I'm not saying I won't fix it, just that this is a "future rawhide" bug not a rawhide bug.

For the record I already have a probable fix and have done a test build in koji to prove that it builds OK against 3.9 but I can't actually commit it until I can test it against 3.10 to make sure there are no other issues.

I don't see how I can test it in mock, short of going to a lot of effort to create a custom configuration that includes the COPR repository.

Comment 6 Miro Hrončok 2020-11-23 19:21:32 UTC
Yes, this is a future rawhide bug. Unfortunately, there is no "future rawhide" column in bugzilla :(

The mock config is one copy paste away from https://copr.fedorainfracloud.org/coprs/g/python/python3.10/ description.

If you send a PR to https://src.fedoraproject.org/rpms/python-mapnik with your fix, the copr repo will build it in https://copr.fedorainfracloud.org/coprs/g/python/python3.10/builds/?dirname=python3.10:pr:<pr number here>

Comment 7 Tom Hughes 2020-11-23 19:28:01 UTC
Opening a PR is probably even more work than a custom mock build but I'll try and do one or the other.

By the way it would have helped if the link to the changelog had actually been to the correct section - at least I assume https://docs.python.org/3.10/whatsnew/changelog.html#id21 is what you meant to link to.

Comment 9 Miro Hrončok 2020-11-23 20:29:08 UTC
Thanks for the fix.