Bug 1900688 - python-mapnik fails to build with Python 3.10: Avoid using PyObject_AsCharBuffer(), PyObject_AsReadBuffer() and PyObject_AsWriteBuffer()
Summary: python-mapnik fails to build with Python 3.10: Avoid using PyObject_AsCharBu...
Alias: None
Product: Fedora
Classification: Fedora
Component: python-mapnik
Version: rawhide
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Tom Hughes
QA Contact: Fedora Extras Quality Assurance
Depends On:
Blocks: PYTHON3.10
TreeView+ depends on / blocked
Reported: 2020-11-23 14:26 UTC by Tomáš Hrnčiar
Modified: 2020-11-23 20:29 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2020-11-23 20:22:05 UTC
Type: Bug

Attachments (Terms of Use)

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)


For the build logs, see:

For all our attempts to build python-mapnik with Python 3.10, see:

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:

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.

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