14
0
forked from pool/python-lmdb

- add py313-support.patch to fix build with py313

- Update to v1.4.0

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-lmdb?expand=0&rev=27
This commit is contained in:
2024-11-19 10:20:45 +00:00
committed by Git OBS Bridge
parent a3b93357b5
commit 509a84dbad
3 changed files with 54 additions and 2 deletions

46
py313-support.patch Normal file
View File

@@ -0,0 +1,46 @@
From 206a3754466397baeb418e70be9d35b12cc4079f Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Wed, 4 Sep 2024 19:09:04 +0200
Subject: [PATCH] Fix build with Python 3.13+
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Avoid using PyObject_AsReadBuffer, do what PyObject_AsReadBuffer does.
Note that this is not safe, and it has never been safe,
but the code does *exactly* what it used to do (at least on Python 3.8+).
Fixes https://github.com/jnwatson/py-lmdb/issues/362
Co-Authored-By: Miro Hrončok <miro@hroncok.cz>
---
lmdb/cpython.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/lmdb/cpython.c b/lmdb/cpython.c
index 3030883..81fdb06 100644
--- a/lmdb/cpython.c
+++ b/lmdb/cpython.c
@@ -545,9 +545,21 @@ val_from_buffer(MDB_val *val, PyObject *buf)
type_error("Won't implicitly convert Unicode to bytes; use .encode()");
return -1;
}
+#if PY_VERSION_HEX < 0x030d0000
return PyObject_AsReadBuffer(buf,
(const void **) &val->mv_data,
(Py_ssize_t *) &val->mv_size);
+#else
+ Py_buffer view;
+ int ret;
+ ret = PyObject_GetBuffer(buf, &view, PyBUF_SIMPLE);
+ if(ret == 0) {
+ val->mv_data = view.buf;
+ val->mv_size = view.len;
+ PyBuffer_Release(&view);
+ }
+ return ret;
+#endif
}
/* ------------------- */

View File

@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Tue Nov 19 10:20:27 UTC 2024 - Dirk Müller <dmueller@suse.com>
- add py313-support.patch to fix build with py313
-------------------------------------------------------------------
Mon Jul 1 16:53:38 UTC 2024 - Mia Herkt <mia@0x0.st>
@@ -12,7 +17,7 @@ Thu Apr 6 16:05:15 UTC 2023 - Mia Herkt <mia@0x0.st>
-------------------------------------------------------------------
Tue Dec 13 15:43:15 UTC 2022 - Yogalakshmi Arunachalam <yarunachalam@suse.com>
- Update to v1.4.0
- Update to v1.4.0
* Update manifest and a copyright
-------------------------------------------------------------------

View File

@@ -24,6 +24,7 @@ License: OLDAP-2.8
Group: Development/Languages/Python
URL: https://github.com/dw/py-lmdb/
Source: https://files.pythonhosted.org/packages/source/l/lmdb/lmdb-%{version}.tar.gz
Patch1: https://github.com/jnwatson/py-lmdb/pull/368/commits/206a3754466397baeb418e70be9d35b12cc4079f.patch#/py313-support.patch
BuildRequires: %{python_module cffi}
BuildRequires: %{python_module devel}
BuildRequires: %{python_module pytest}
@@ -52,7 +53,7 @@ LMDB is a tiny database with the following properties:
LMDB uses the operating systems buffer cache.
%prep
%setup -q -n lmdb-%{version}
%autosetup -p1 -n lmdb-%{version}
%build
export LMDB_FORCE_SYSTEM=1