Skip to content

Fails to build with Python 3.13 due to removal of PyObject_AsReadBuffer #362

Closed
@AdamWill

Description

@AdamWill

Affected Operating Systems

All

Affected py-lmdb Version

All

py-lmdb Installation Method

Irrelevant

Using bundled or distribution-provided LMDB library?

Irrelevant

Distribution name and LMDB library version

Irrelevant

Machine "free -m" output

Irrelevant

Other important machine info

Irrelevant

Describe Your Problem

py-lmdb does not build against Python 3.13 because it uses PyObject_AsReadBuffer, which was removed in Python 3.13. The recommended replacement is PyObject_GetBuffer and PyBuffer_Release.

Errors/exceptions Encountered

    lmdb/cpython.c: In function ‘val_from_buffer’:
    lmdb/cpython.c:586:12: error: implicit declaration of function ‘PyObject_AsReadBuffer’; did you mean ‘PyObject_GetBuffer’? [-Wimplicit-function-declaration]
      586 |     return PyObject_AsReadBuffer(buf,
          |            ^~~~~~~~~~~~~~~~~~~~~
          |            PyObject_GetBuffer

Describe What You Expected To Happen

Successful build.

Describe What Happened Instead

Failed build.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions