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: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: jakub.ruzicka, mhroncok, nicki, pspacek, pviktori, python-sig, thrnciar
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python3.10-3.10.0~rc1-1.fc35 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-08-04 21:37:20 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, 1969179, 1987896    

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 (pviktori) 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.

Comment 3 Miro Hrončok 2021-08-04 14:31:55 UTC
With Python 3.10.0rc1, this works again. https://bugs.python.org/issue41103

https://copr.fedorainfracloud.org/coprs/g/python/python3.10/package/python-zict/

Comment 4 Fedora Update System 2021-08-04 21:36:20 UTC
FEDORA-2021-47a24beeaa has been pushed to the Fedora 35 stable repository.
If problem still persists, please make note of it in this bug report.