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 1971260

Summary: lmdb is not importable on Python 3.10
Product: [Fedora] Fedora Reporter: Elliott Sales de Andrade <quantum.analyst>
Component: python-lmdbAssignee: Petr Špaček <pspacek>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: jakub.ruzicka, mhroncok, pspacek, pviktori, python-sig, thrnciar, tomas.krizek
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: 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, 1969179    

Description Elliott Sales de Andrade 2021-06-13 08:49:02 UTC
Description of problem:
Installing lmdb in Rawhide produces an un-importable package.


Version-Release number of selected component (if applicable):
$ rpm -q python3-lmdb
python3-lmdb-1.0.0-2.fc35.x86_64


Steps to Reproduce:
1. mock -r fedora-rawhide-x86_64 --install python3-lmdb  (may need --enablerepo=local right now)
2. mock -r fedora-rawhide-x86_64 --shell
3. python3 -c 'import lmdb'


Actual results:
Traceback (most recent call last):
  File "/usr/lib64/python3.10/site-packages/lmdb/__init__.py", line 42, in <module>
    from lmdb.cpython import *
ImportError: /usr/lib64/python3.10/site-packages/lmdb/cpython.cpython-310-x86_64-linux-gnu.so: undefined symbol: PyObject_AsReadBuffer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib64/python3.10/site-packages/lmdb/__init__.py", line 48, in <module>
    from lmdb.cffi import *
  File "/usr/lib64/python3.10/site-packages/lmdb/cffi.py", line 353, in <module>
    import cffi
ModuleNotFoundError: No module named 'cffi'


Expected results:
The CPython extension uses API that was removed in Python 3.10. It should be updated to not use it. If this cannot be done, the fallback to cffi should be fixed by adding a dependency on cffi.

Comment 1 Miro Hrončok 2021-06-14 10:37:26 UTC
PyObject_AsReadBuffer:

bpo-41103: PyObject_AsCharBuffer(), PyObject_AsReadBuffer(), PyObject_CheckReadBuffer(), and PyObject_AsWriteBuffer() are removed. Please migrate to new buffer protocol; PyObject_GetBuffer() and PyBuffer_Release().

https://docs.python.org/3.10/whatsnew/3.10.html#id4

Comment 2 Petr Viktorin 2021-06-16 15:30:37 UTC
I added a patch to the upstream commit that should make py-lmdb compile and work as it did on 3.9.
I do hope upstream comes up with a better fix, though.