Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-lmdb for openSUSE:Factory checked in at 2024-07-02 18:17:35 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-lmdb (Old) and /work/SRC/openSUSE:Factory/.python-lmdb.new.18349 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-lmdb" Tue Jul 2 18:17:35 2024 rev:12 rq:1184348 version:1.5.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-lmdb/python-lmdb.changes 2023-04-07 18:16:55.504752374 +0200 +++ /work/SRC/openSUSE:Factory/.python-lmdb.new.18349/python-lmdb.changes 2024-07-02 18:17:38.970053317 +0200 @@ -1,0 +2,5 @@ +Mon Jul 1 16:53:38 UTC 2024 - Mia Herkt <[email protected]> + +- Update to 1.5.1 (no changes for openSUSE) + +------------------------------------------------------------------- Old: ---- lmdb-1.4.1.tar.gz New: ---- lmdb-1.5.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-lmdb.spec ++++++ --- /var/tmp/diff_new_pack.lqa0Wm/_old 2024-07-02 18:17:40.890123579 +0200 +++ /var/tmp/diff_new_pack.lqa0Wm/_new 2024-07-02 18:17:40.890123579 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-lmdb # -# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,14 +16,13 @@ # -%{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-lmdb -Version: 1.4.1 +Version: 1.5.1 Release: 0 Summary: Universal Python binding for the LMDB 'Lightning' Database License: OLDAP-2.8 Group: Development/Languages/Python -URL: http://github.com/dw/py-lmdb/ +URL: https://github.com/dw/py-lmdb/ Source: https://files.pythonhosted.org/packages/source/l/lmdb/lmdb-%{version}.tar.gz BuildRequires: %{python_module cffi} BuildRequires: %{python_module devel} @@ -62,7 +61,7 @@ %check %python_exec setup.py develop --user %python_exec -c 'import lmdb.cpython' -%python_exec -m pytest -v tests +%pytest tests %install %python_install @@ -71,5 +70,6 @@ %files %{python_files} %license LICENSE %doc README.md ChangeLog -%{python_sitearch}/* +%{python_sitearch}/lmdb +%{python_sitearch}/lmdb-%{version}*-info ++++++ lmdb-1.4.1.tar.gz -> lmdb-1.5.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-1.4.1/ChangeLog new/lmdb-1.5.1/ChangeLog --- old/lmdb-1.4.1/ChangeLog 2023-04-06 08:42:11.000000000 +0200 +++ new/lmdb-1.5.1/ChangeLog 2024-07-01 08:57:53.000000000 +0200 @@ -1,3 +1,13 @@ +2024-07-01 1.5.1 +* CI-only fix. + +2024-06-30 1.5.0 +* Add Python 3.12 binaries. + +* Update bundled LMDB to 0.9.31. + +* Remove Python 2.7 support. + 2022-04-04 v1.4.1 * Update CI to build manylinux binaries. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-1.4.1/PKG-INFO new/lmdb-1.5.1/PKG-INFO --- old/lmdb-1.4.1/PKG-INFO 2023-04-06 08:42:21.875925800 +0200 +++ new/lmdb-1.5.1/PKG-INFO 2024-07-01 08:58:03.667085200 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: lmdb -Version: 1.4.1 +Version: 1.5.1 Summary: Universal Python binding for the LMDB 'Lightning' Database Home-page: http://github.com/jnwatson/py-lmdb/ Author: David Wilson @@ -9,10 +9,7 @@ Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy -Classifier: Programming Language :: Python :: 2 -Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 @@ -20,6 +17,7 @@ Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 Classifier: Topic :: Database Classifier: Topic :: Database :: Database Engines/Servers Description-Content-Type: text/plain diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-1.4.1/README.md new/lmdb-1.5.1/README.md --- old/lmdb-1.4.1/README.md 2023-04-06 08:42:11.000000000 +0200 +++ new/lmdb-1.5.1/README.md 2024-07-01 08:57:53.000000000 +0200 @@ -7,11 +7,7 @@ # Python Version Support Statement -This project has been around for a while. Previously, it supported all the way back to before 2.5. Currently py-lmdb -supports Python 2.7, Python >= 3.5, and pypy. - -Python 2.7 is now end-of-life. If you are still using Python 2.7, you should strongly considering porting to Python -3. - -That said, this project will continue to support running on Python 2.7 until Github Actions remove support for it. +This project has been around for a while. Previously, it supported all the way back to before 2.5. Currently, py-lmdb +supports Python >= 3.5 and pypy. +The last version of py-lmdb that supported Python 2.7 was 1.4.1. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-1.4.1/docs/index.rst new/lmdb-1.5.1/docs/index.rst --- old/lmdb-1.4.1/docs/index.rst 2023-04-06 08:42:11.000000000 +0200 +++ new/lmdb-1.5.1/docs/index.rst 2024-07-01 08:57:53.000000000 +0200 @@ -11,9 +11,8 @@ This is a universal Python binding for the `LMDB 'Lightning' Database <http://lmdb.tech/>`_. Two variants are provided and automatically selected during install: a `CFFI <https://cffi.readthedocs.io/en/release-0.5/>`_ variant -that supports `PyPy <http://www.pypy.org/>`_ and all versions of CPython >=2.7, -and a C extension that supports CPython >=2.7 and >=3.4. Both variants -provide the same interface. +that supports `PyPy <http://www.pypy.org/>`_ and all versions of CPython >=3.5, +and a C extension that supports >= 3.5. Both variants provide the same interface. LMDB is a tiny database with some excellent properties: @@ -41,21 +40,12 @@ present. The binary releases statically link against the bundled version of LMDB. -Initially 32-bit and 64-bit binaries are provided for Python 2.7; in future -binaries will be published for all supported versions of Python. - To install, use a command like: :: C:\Python27\python -mpip install lmdb -Or: - - :: - - C:\Python27\python -measy_install lmdb - Installation: UNIX ++++++++++++++++++ @@ -78,14 +68,12 @@ apt-get install libffi-dev python-dev build-essential -To install the C extension, ensure a C compiler and `pip` or `easy_install` are +To install the C extension, ensure a C compiler and `pip` are available and type: :: pip install lmdb - # or - easy_install lmdb The CFFI variant may be used on CPython by setting the ``LMDB_FORCE_CFFI`` environment variable before installation, or before module import with an @@ -194,21 +182,11 @@ Bytestrings +++++++++++ -This documentation uses `bytestring` to mean either the Python<=2.7 -:py:func:`str` type, or the Python>=3.0 :py:func:`bytes` type, depending on the -Python version in use. - -Due to the design of Python 2.x, LMDB will happily accept Unicode instances -where :py:func:`str` instances are expected, so long as they contain only ASCII -characters, in which case they are implicitly encoded to ASCII. You should not -rely on this behaviour! It results in brittle programs that often break the -moment they are deployed in production. Always explicitly encode and decode any -Unicode values before passing them to LMDB. +This documentation uses `bytestring` to mean the Python>=3.0 :py:func:`bytes` +type. This documentation uses :py:func:`bytes` in examples. In Python 3.x this is a -distinct type, whereas in Python 2.7 it is simply an alias for -:py:func:`str`. - +distinct type. Buffers +++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-1.4.1/lib/lmdb.h new/lmdb-1.5.1/lib/lmdb.h --- old/lmdb-1.4.1/lib/lmdb.h 2023-04-06 08:42:11.000000000 +0200 +++ new/lmdb-1.5.1/lib/lmdb.h 2024-07-01 08:57:53.000000000 +0200 @@ -200,7 +200,7 @@ /** Library minor version */ #define MDB_VERSION_MINOR 9 /** Library patch version */ -#define MDB_VERSION_PATCH 29 +#define MDB_VERSION_PATCH 31 /** Combine args a,b,c into a single integer for easy version comparisons */ #define MDB_VERINT(a,b,c) (((a) << 24) | ((b) << 16) | (c)) @@ -210,7 +210,7 @@ MDB_VERINT(MDB_VERSION_MAJOR,MDB_VERSION_MINOR,MDB_VERSION_PATCH) /** The release date of this library version */ -#define MDB_VERSION_DATE "March 16, 2021" +#define MDB_VERSION_DATE "July 10, 2023" /** A stringifier for the version info */ #define MDB_VERSTR(a,b,c,d) "LMDB " #a "." #b "." #c ": (" d ")" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-1.4.1/lib/mdb.c new/lmdb-1.5.1/lib/mdb.c --- old/lmdb-1.4.1/lib/mdb.c 2023-04-06 08:42:11.000000000 +0200 +++ new/lmdb-1.5.1/lib/mdb.c 2024-07-01 08:57:53.000000000 +0200 @@ -77,8 +77,7 @@ #if defined(__mips) && defined(__linux) /* MIPS has cache coherency issues, requires explicit cache control */ -#include <asm/cachectl.h> -extern int cacheflush(char *addr, int nbytes, int cache); +#include <sys/cachectl.h> #define CACHEFLUSH(addr, bytes, cache) cacheflush(addr, bytes, cache) #else #define CACHEFLUSH(addr, bytes, cache) @@ -200,15 +199,21 @@ # error "Two's complement, reasonably sized integer types, please" #endif -#ifdef __GNUC__ -/** Put infrequently used env functions in separate section */ -# ifdef __APPLE__ -# define ESECT __attribute__ ((section("__TEXT,text_env"))) +#if (((__clang_major__ << 8) | __clang_minor__) >= 0x0302) || (((__GNUC__ << 8) | __GNUC_MINOR__) >= 0x0403) +/** Mark infrequently used env functions as cold. This puts them in a separate + * section, and optimizes them for size */ +#define ESECT __attribute__ ((cold)) +#else +/* On older compilers, use a separate section */ +# ifdef __GNUC__ +# ifdef __APPLE__ +# define ESECT __attribute__ ((section("__TEXT,text_env"))) +# else +# define ESECT __attribute__ ((section("text_env"))) +# endif # else -# define ESECT __attribute__ ((section("text_env"))) +# define ESECT # endif -#else -#define ESECT #endif #ifdef _WIN32 @@ -833,9 +838,26 @@ } pb; uint32_t pb_pages; /**< number of overflow pages */ } mp_pb; - indx_t mp_ptrs[1]; /**< dynamic size */ + indx_t mp_ptrs[0]; /**< dynamic size */ } MDB_page; +/** Alternate page header, for 2-byte aligned access */ +typedef struct MDB_page2 { + uint16_t mp2_p[sizeof(pgno_t)/2]; + uint16_t mp2_pad; + uint16_t mp2_flags; + indx_t mp2_lower; + indx_t mp2_upper; + indx_t mp2_ptrs[0]; +} MDB_page2; + +#define MP_PGNO(p) (((MDB_page2 *)(void *)(p))->mp2_p) +#define MP_PAD(p) (((MDB_page2 *)(void *)(p))->mp2_pad) +#define MP_FLAGS(p) (((MDB_page2 *)(void *)(p))->mp2_flags) +#define MP_LOWER(p) (((MDB_page2 *)(void *)(p))->mp2_lower) +#define MP_UPPER(p) (((MDB_page2 *)(void *)(p))->mp2_upper) +#define MP_PTRS(p) (((MDB_page2 *)(void *)(p))->mp2_ptrs) + /** Size of the page header, excluding dynamic data at the end */ #define PAGEHDRSZ ((unsigned) offsetof(MDB_page, mp_ptrs)) @@ -846,10 +868,10 @@ #define PAGEBASE ((MDB_DEVEL) ? PAGEHDRSZ : 0) /** Number of nodes on a page */ -#define NUMKEYS(p) (((p)->mp_lower - (PAGEHDRSZ-PAGEBASE)) >> 1) +#define NUMKEYS(p) ((MP_LOWER(p) - (PAGEHDRSZ-PAGEBASE)) >> 1) /** The amount of space remaining in the page */ -#define SIZELEFT(p) (indx_t)((p)->mp_upper - (p)->mp_lower) +#define SIZELEFT(p) (indx_t)(MP_UPPER(p) - MP_LOWER(p)) /** The percentage of space used in the page, in tenths of a percent. */ #define PAGEFILL(env, p) (1000L * ((env)->me_psize - PAGEHDRSZ - SIZELEFT(p)) / \ @@ -860,15 +882,15 @@ #define FILL_THRESHOLD 250 /** Test if a page is a leaf page */ -#define IS_LEAF(p) F_ISSET((p)->mp_flags, P_LEAF) +#define IS_LEAF(p) F_ISSET(MP_FLAGS(p), P_LEAF) /** Test if a page is a LEAF2 page */ -#define IS_LEAF2(p) F_ISSET((p)->mp_flags, P_LEAF2) +#define IS_LEAF2(p) F_ISSET(MP_FLAGS(p), P_LEAF2) /** Test if a page is a branch page */ -#define IS_BRANCH(p) F_ISSET((p)->mp_flags, P_BRANCH) +#define IS_BRANCH(p) F_ISSET(MP_FLAGS(p), P_BRANCH) /** Test if a page is an overflow page */ -#define IS_OVERFLOW(p) F_ISSET((p)->mp_flags, P_OVERFLOW) +#define IS_OVERFLOW(p) F_ISSET(MP_FLAGS(p), P_OVERFLOW) /** Test if a page is a sub page */ -#define IS_SUBP(p) F_ISSET((p)->mp_flags, P_SUBP) +#define IS_SUBP(p) F_ISSET(MP_FLAGS(p), P_SUBP) /** The number of overflow pages needed to store the given size. */ #define OVPAGES(size, psize) ((PAGEHDRSZ-1 + (size)) / (psize) + 1) @@ -936,7 +958,7 @@ #define LEAFSIZE(k, d) (NODESIZE + (k)->mv_size + (d)->mv_size) /** Address of node \b i in page \b p */ -#define NODEPTR(p, i) ((MDB_node *)((char *)(p) + (p)->mp_ptrs[i] + PAGEBASE)) +#define NODEPTR(p, i) ((MDB_node *)((char *)(p) + MP_PTRS(p)[i] + PAGEBASE)) /** Address of the key for the node */ #define NODEKEY(node) (void *)((node)->mn_data) @@ -964,6 +986,8 @@ /** Copy a page number from src to dst */ #ifdef MISALIGNED_OK #define COPY_PGNO(dst,src) dst = src +#undef MP_PGNO +#define MP_PGNO(p) ((p)->mp_pgno) #else #if SIZE_MAX > 4294967295UL #define COPY_PGNO(dst,src) do { \ @@ -1517,6 +1541,8 @@ NULL, err, 0, ptr, MSGSIZE, (va_list *)buf+MSGSIZE); return ptr; #else + if (err < 0) + return "Invalid error code"; return strerror(err); #endif } @@ -1554,7 +1580,7 @@ mdb_dbg_pgno(MDB_page *mp) { pgno_t ret; - COPY_PGNO(ret, mp->mp_pgno); + COPY_PGNO(ret, MP_PGNO(mp)); return ret; } @@ -1601,13 +1627,13 @@ mdb_page_list(MDB_page *mp) { pgno_t pgno = mdb_dbg_pgno(mp); - const char *type, *state = (mp->mp_flags & P_DIRTY) ? ", dirty" : ""; + const char *type, *state = (MP_FLAGS(mp) & P_DIRTY) ? ", dirty" : ""; MDB_node *node; unsigned int i, nkeys, nsize, total = 0; MDB_val key; DKBUF; - switch (mp->mp_flags & (P_BRANCH|P_LEAF|P_LEAF2|P_META|P_OVERFLOW|P_SUBP)) { + switch (MP_FLAGS(mp) & (P_BRANCH|P_LEAF|P_LEAF2|P_META|P_OVERFLOW|P_SUBP)) { case P_BRANCH: type = "Branch page"; break; case P_LEAF: type = "Leaf page"; break; case P_LEAF|P_SUBP: type = "Sub-page"; break; @@ -1622,7 +1648,7 @@ pgno, ((MDB_meta *)METADATA(mp))->mm_txnid); return; default: - fprintf(stderr, "Bad page %"Z"u flags 0x%X\n", pgno, mp->mp_flags); + fprintf(stderr, "Bad page %"Z"u flags 0x%X\n", pgno, MP_FLAGS(mp)); return; } @@ -1658,7 +1684,7 @@ total = EVEN(total); } fprintf(stderr, "Total: header %d + contents %d + unused %d\n", - IS_LEAF2(mp) ? PAGEHDRSZ : PAGEBASE + mp->mp_lower, total, SIZELEFT(mp)); + IS_LEAF2(mp) ? PAGEHDRSZ : PAGEBASE + MP_LOWER(mp), total, SIZELEFT(mp)); } void @@ -2418,7 +2444,7 @@ pgno_t pgno; int rc; - if (!F_ISSET(mp->mp_flags, P_DIRTY)) { + if (!F_ISSET(MP_FLAGS(mp), P_DIRTY)) { if (txn->mt_flags & MDB_TXN_SPILLS) { np = NULL; rc = mdb_page_unspill(txn, mp, &np); @@ -6061,7 +6087,7 @@ mc->mc_ki[mc->mc_top] = 0; return MDB_NOTFOUND; } - if (mp->mp_flags & P_LEAF2) { + if (MP_FLAGS(mp) & P_LEAF2) { nodekey.mv_size = mc->mc_db->md_pad; nodekey.mv_data = LEAF2KEY(mp, 0, nodekey.mv_size); } else { @@ -6082,7 +6108,7 @@ unsigned int i; unsigned int nkeys = NUMKEYS(mp); if (nkeys > 1) { - if (mp->mp_flags & P_LEAF2) { + if (MP_FLAGS(mp) & P_LEAF2) { nodekey.mv_data = LEAF2KEY(mp, nkeys-1, nodekey.mv_size); } else { @@ -6100,7 +6126,7 @@ if (rc < 0) { if (mc->mc_ki[mc->mc_top] < NUMKEYS(mp)) { /* This is definitely the right page, skip search_page */ - if (mp->mp_flags & P_LEAF2) { + if (MP_FLAGS(mp) & P_LEAF2) { nodekey.mv_data = LEAF2KEY(mp, mc->mc_ki[mc->mc_top], nodekey.mv_size); } else { @@ -6477,6 +6503,7 @@ rc = MDB_NOTFOUND; break; } + mc->mc_flags &= ~C_EOF; { MDB_node *leaf = NODEPTR(mc->mc_pg[mc->mc_top], mc->mc_ki[mc->mc_top]); if (!F_ISSET(leaf->mn_flags, F_DUPDATA)) { @@ -6663,7 +6690,7 @@ *mc->mc_dbflag |= DB_DIRTY; if ((mc->mc_db->md_flags & (MDB_DUPSORT|MDB_DUPFIXED)) == MDB_DUPFIXED) - np->mp_flags |= P_LEAF2; + MP_FLAGS(np) |= P_LEAF2; mc->mc_flags |= C_INITIALIZED; } else { /* make sure all cursor pages are writable */ @@ -6685,7 +6712,7 @@ fp_flags = P_LEAF|P_DIRTY; fp = env->me_pbuf; fp->mp_pad = data->mv_size; /* used if MDB_DUPFIXED */ - fp->mp_lower = fp->mp_upper = (PAGEHDRSZ-PAGEBASE); + MP_LOWER(fp) = MP_UPPER(fp) = (PAGEHDRSZ-PAGEBASE); olddata.mv_size = PAGEHDRSZ; goto prep_subDB; } @@ -6761,18 +6788,18 @@ dkey.mv_data = memcpy(fp+1, olddata.mv_data, olddata.mv_size); /* Make sub-page header for the dup items, with dummy body */ - fp->mp_flags = P_LEAF|P_DIRTY|P_SUBP; - fp->mp_lower = (PAGEHDRSZ-PAGEBASE); + MP_FLAGS(fp) = P_LEAF|P_DIRTY|P_SUBP; + MP_LOWER(fp) = (PAGEHDRSZ-PAGEBASE); xdata.mv_size = PAGEHDRSZ + dkey.mv_size + data->mv_size; if (mc->mc_db->md_flags & MDB_DUPFIXED) { - fp->mp_flags |= P_LEAF2; + MP_FLAGS(fp) |= P_LEAF2; fp->mp_pad = data->mv_size; xdata.mv_size += 2 * data->mv_size; /* leave space for 2 more */ } else { xdata.mv_size += 2 * (sizeof(indx_t) + NODESIZE) + (dkey.mv_size & 1) + (data->mv_size & 1); } - fp->mp_upper = xdata.mv_size - PAGEBASE; + MP_UPPER(fp) = xdata.mv_size - PAGEBASE; olddata.mv_size = xdata.mv_size; /* pretend olddata is fp */ } else if (leaf->mn_flags & F_SUBDATA) { /* Data is on sub-DB, just store it */ @@ -6795,8 +6822,8 @@ } /* FALLTHRU */ /* Big enough MDB_DUPFIXED sub-page */ case MDB_CURRENT: - fp->mp_flags |= P_DIRTY; - COPY_PGNO(fp->mp_pgno, mp->mp_pgno); + MP_FLAGS(fp) |= P_DIRTY; + COPY_PGNO(MP_PGNO(fp), MP_PGNO(mp)); mc->mc_xcursor->mx_cursor.mc_pg[0] = fp; flags |= F_DUPDATA; goto put_sub; @@ -6804,7 +6831,7 @@ xdata.mv_size = olddata.mv_size + offset; } - fp_flags = fp->mp_flags; + fp_flags = MP_FLAGS(fp); if (NODESIZE + NODEKSZ(leaf) + xdata.mv_size > env->me_nodemax) { /* Too big for a sub-page, convert to sub-DB */ fp_flags &= ~P_SUBP; @@ -6834,16 +6861,16 @@ sub_root = mp; } if (mp != fp) { - mp->mp_flags = fp_flags | P_DIRTY; - mp->mp_pad = fp->mp_pad; - mp->mp_lower = fp->mp_lower; - mp->mp_upper = fp->mp_upper + offset; + MP_FLAGS(mp) = fp_flags | P_DIRTY; + MP_PAD(mp) = MP_PAD(fp); + MP_LOWER(mp) = MP_LOWER(fp); + MP_UPPER(mp) = MP_UPPER(fp) + offset; if (fp_flags & P_LEAF2) { memcpy(METADATA(mp), METADATA(fp), NUMKEYS(fp) * fp->mp_pad); } else { - memcpy((char *)mp + mp->mp_upper + PAGEBASE, (char *)fp + fp->mp_upper + PAGEBASE, - olddata.mv_size - fp->mp_upper - PAGEBASE); - memcpy((char *)(&mp->mp_ptrs), (char *)(&fp->mp_ptrs), NUMKEYS(fp) * sizeof(mp->mp_ptrs[0])); + memcpy((char *)mp + MP_UPPER(mp) + PAGEBASE, (char *)fp + MP_UPPER(fp) + PAGEBASE, + olddata.mv_size - MP_UPPER(fp) - PAGEBASE); + memcpy((char *)MP_PTRS(mp), (char *)MP_PTRS(fp), NUMKEYS(fp) * sizeof(mp->mp_ptrs[0])); for (i=0; i<NUMKEYS(fp); i++) mp->mp_ptrs[i] += offset; } @@ -6908,7 +6935,7 @@ * Copy end of page, adjusting alignment so * compiler may copy words instead of bytes. */ - off = (PAGEHDRSZ + data->mv_size) & -sizeof(size_t); + off = (PAGEHDRSZ + data->mv_size) & -(int)sizeof(size_t); memcpy((size_t *)((char *)np + off), (size_t *)((char *)omp + off), sz - off); sz = PAGEHDRSZ; @@ -6936,11 +6963,14 @@ else if (!(mc->mc_flags & C_SUB)) memcpy(olddata.mv_data, data->mv_data, data->mv_size); else { + if (key->mv_size != NODEKSZ(leaf)) + goto new_ksize; memcpy(NODEKEY(leaf), key->mv_data, key->mv_size); goto fix_parent; } return MDB_SUCCESS; } +new_ksize: mdb_node_del(mc, 0); } @@ -7291,7 +7321,7 @@ void *ndata; DKBUF; - mdb_cassert(mc, mp->mp_upper >= mp->mp_lower); + mdb_cassert(mc, MP_UPPER(mp) >= MP_LOWER(mp)); DPRINTF(("add to %s %spage %"Z"u index %i, data size %"Z"u key size %"Z"u [%s]", IS_LEAF(mp) ? "leaf" : "branch", @@ -7310,8 +7340,8 @@ memcpy(ptr, key->mv_data, ksize); /* Just using these for counting */ - mp->mp_lower += sizeof(indx_t); - mp->mp_upper -= ksize - sizeof(indx_t); + MP_LOWER(mp) += sizeof(indx_t); + MP_UPPER(mp) -= ksize - sizeof(indx_t); return MDB_SUCCESS; } @@ -7348,14 +7378,14 @@ update: /* Move higher pointers up one slot. */ for (i = NUMKEYS(mp); i > indx; i--) - mp->mp_ptrs[i] = mp->mp_ptrs[i - 1]; + MP_PTRS(mp)[i] = MP_PTRS(mp)[i - 1]; /* Adjust free space offsets. */ - ofs = mp->mp_upper - node_size; - mdb_cassert(mc, ofs >= mp->mp_lower + sizeof(indx_t)); - mp->mp_ptrs[indx] = ofs; - mp->mp_upper = ofs; - mp->mp_lower += sizeof(indx_t); + ofs = MP_UPPER(mp) - node_size; + mdb_cassert(mc, ofs >= MP_LOWER(mp) + sizeof(indx_t)); + MP_PTRS(mp)[indx] = ofs; + MP_UPPER(mp) = ofs; + MP_LOWER(mp) += sizeof(indx_t); /* Write the node data. */ node = NODEPTR(mp, indx); @@ -7393,7 +7423,7 @@ full: DPRINTF(("not enough room in page %"Z"u, got %u ptrs", mdb_dbg_pgno(mp), NUMKEYS(mp))); - DPRINTF(("upper-lower = %u - %u = %"Z"d", mp->mp_upper,mp->mp_lower,room)); + DPRINTF(("upper-lower = %u - %u = %"Z"d", MP_UPPER(mp),MP_LOWER(mp),room)); DPRINTF(("node size = %"Z"u", node_size)); mc->mc_txn->mt_flags |= MDB_TXN_ERROR; return MDB_PAGE_FULL; @@ -7424,8 +7454,8 @@ base = LEAF2KEY(mp, indx, ksize); if (x) memmove(base, base + ksize, x * ksize); - mp->mp_lower -= sizeof(indx_t); - mp->mp_upper += ksize - sizeof(indx_t); + MP_LOWER(mp) -= sizeof(indx_t); + MP_UPPER(mp) += ksize - sizeof(indx_t); return; } @@ -7439,21 +7469,21 @@ } sz = EVEN(sz); - ptr = mp->mp_ptrs[indx]; + ptr = MP_PTRS(mp)[indx]; for (i = j = 0; i < numkeys; i++) { if (i != indx) { - mp->mp_ptrs[j] = mp->mp_ptrs[i]; - if (mp->mp_ptrs[i] < ptr) - mp->mp_ptrs[j] += sz; + MP_PTRS(mp)[j] = MP_PTRS(mp)[i]; + if (MP_PTRS(mp)[i] < ptr) + MP_PTRS(mp)[j] += sz; j++; } } - base = (char *)mp + mp->mp_upper + PAGEBASE; - memmove(base + sz, base, ptr - mp->mp_upper); + base = (char *)mp + MP_UPPER(mp) + PAGEBASE; + memmove(base + sz, base, ptr - MP_UPPER(mp)); - mp->mp_lower -= sizeof(indx_t); - mp->mp_upper += sz; + MP_LOWER(mp) -= sizeof(indx_t); + MP_UPPER(mp) += sz; } /** Compact the main page after deleting a node on a subpage. @@ -7482,11 +7512,11 @@ } else { xp = (MDB_page *)((char *)sp + delta); /* destination subpage */ for (i = NUMKEYS(sp); --i >= 0; ) - xp->mp_ptrs[i] = sp->mp_ptrs[i] - delta; + MP_PTRS(xp)[i] = MP_PTRS(sp)[i] - delta; len = PAGEHDRSZ; } - sp->mp_upper = sp->mp_lower; - COPY_PGNO(sp->mp_pgno, mp->mp_pgno); + MP_UPPER(sp) = MP_LOWER(sp); + COPY_PGNO(MP_PGNO(sp), mp->mp_pgno); SETDSZ(node, nsize); /* Shift <lower nodes...initial part of subpage> upward */ @@ -7557,7 +7587,7 @@ mx->mx_db.md_leaf_pages = 1; mx->mx_db.md_overflow_pages = 0; mx->mx_db.md_entries = NUMKEYS(fp); - COPY_PGNO(mx->mx_db.md_root, fp->mp_pgno); + COPY_PGNO(mx->mx_db.md_root, MP_PGNO(fp)); mx->mx_cursor.mc_snum = 1; mx->mx_cursor.mc_top = 0; mx->mx_cursor.mc_flags = C_INITIALIZED|C_SUB; @@ -8729,9 +8759,13 @@ mc->mc_ki[mc->mc_top] = x; } } else { - int psize, nsize, k; + int psize, nsize, k, keythresh; + /* Maximum free space in an empty page */ pmax = env->me_psize - PAGEHDRSZ; + /* Threshold number of keys considered "small" */ + keythresh = env->me_psize >> 7; + if (IS_LEAF(mp)) nsize = mdb_leaf_size(env, newkey, newdata); else @@ -8772,7 +8806,7 @@ * the split so the new page is emptier than the old page. * This yields better packing during sequential inserts. */ - if (nkeys < 32 || nsize > pmax/16 || newindx >= nkeys) { + if (nkeys < keythresh || nsize > pmax/16 || newindx >= nkeys) { /* Find split point */ psize = 0; if (newindx <= split_indx || newindx >= nkeys) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-1.4.1/lib/midl.c new/lmdb-1.5.1/lib/midl.c --- old/lmdb-1.4.1/lib/midl.c 2023-04-06 08:42:11.000000000 +0200 +++ new/lmdb-1.5.1/lib/midl.c 2024-07-01 08:57:53.000000000 +0200 @@ -3,8 +3,8 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software <http://www.openldap.org/>. * - * Copyright 2000-2020 The OpenLDAP Foundation. - * Portions Copyright 2001-2020 Howard Chu, Symas Corp. + * Copyright 2000-2021 The OpenLDAP Foundation. + * Portions Copyright 2001-2021 Howard Chu, Symas Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-1.4.1/lib/midl.h new/lmdb-1.5.1/lib/midl.h --- old/lmdb-1.4.1/lib/midl.h 2023-04-06 08:42:11.000000000 +0200 +++ new/lmdb-1.5.1/lib/midl.h 2024-07-01 08:57:53.000000000 +0200 @@ -11,8 +11,8 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software <http://www.openldap.org/>. * - * Copyright 2000-2020 The OpenLDAP Foundation. - * Portions Copyright 2001-2020 Howard Chu, Symas Corp. + * Copyright 2000-2021 The OpenLDAP Foundation. + * Portions Copyright 2001-2021 Howard Chu, Symas Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-1.4.1/lib/py-lmdb/env-copy-txn.patch new/lmdb-1.5.1/lib/py-lmdb/env-copy-txn.patch --- old/lmdb-1.4.1/lib/py-lmdb/env-copy-txn.patch 2023-04-06 08:42:11.000000000 +0200 +++ new/lmdb-1.5.1/lib/py-lmdb/env-copy-txn.patch 2024-07-01 08:57:53.000000000 +0200 @@ -1,5 +1,5 @@ diff --git a/libraries/liblmdb/lmdb.h b/libraries/liblmdb/lmdb.h -index 69aa2751a2..ff7f77a10d 100644 +index ff03c22..3d6f4cc 100644 --- a/libraries/liblmdb/lmdb.h +++ b/libraries/liblmdb/lmdb.h @@ -682,9 +682,14 @@ int mdb_env_copyfd(MDB_env *env, mdb_filehandle_t fd); @@ -32,10 +32,10 @@ /** @brief Return statistics about the LMDB environment. * diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c -index 8cecdb2e69..9ede4183dd 100644 +index deb6779..b5d152c 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c -@@ -9332,12 +9332,12 @@ done: +@@ -9366,12 +9366,12 @@ done: /** Copy environment with compaction. */ static int ESECT @@ -50,7 +50,7 @@ pthread_t thr; pgno_t root, new_root; int rc = MDB_SUCCESS; -@@ -9383,9 +9383,11 @@ mdb_env_copyfd1(MDB_env *env, HANDLE fd) +@@ -9417,9 +9417,11 @@ mdb_env_copyfd1(MDB_env *env, HANDLE fd) if (rc) goto done; @@ -65,7 +65,7 @@ mp = (MDB_page *)my.mc_wbuf[0]; memset(mp, 0, NUM_METAS * env->me_psize); -@@ -9445,7 +9447,8 @@ finish: +@@ -9479,7 +9481,8 @@ finish: my.mc_error = rc; mdb_env_cthr_toggle(&my, 1 | MDB_EOF); rc = THREAD_FINISH(thr); @@ -75,7 +75,7 @@ done: #ifdef _WIN32 -@@ -9562,12 +9565,22 @@ leave: +@@ -9596,12 +9599,22 @@ leave: } int ESECT @@ -100,7 +100,7 @@ } int ESECT -@@ -9578,6 +9591,12 @@ mdb_env_copyfd(MDB_env *env, HANDLE fd) +@@ -9612,6 +9625,12 @@ mdb_env_copyfd(MDB_env *env, HANDLE fd) int ESECT mdb_env_copy2(MDB_env *env, const char *path, unsigned int flags) @@ -113,7 +113,7 @@ { int rc; MDB_name fname; -@@ -9589,7 +9608,7 @@ mdb_env_copy2(MDB_env *env, const char *path, unsigned int flags) +@@ -9623,7 +9642,7 @@ mdb_env_copy2(MDB_env *env, const char *path, unsigned int flags) mdb_fname_destroy(fname); } if (rc == MDB_SUCCESS) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-1.4.1/lmdb/__init__.py new/lmdb-1.5.1/lmdb/__init__.py --- old/lmdb-1.4.1/lmdb/__init__.py 2023-04-06 08:42:11.000000000 +0200 +++ new/lmdb-1.5.1/lmdb/__init__.py 2024-07-01 08:57:53.000000000 +0200 @@ -50,4 +50,4 @@ from lmdb.cffi import __all__ from lmdb.cffi import __doc__ -__version__ = '1.4.1' +__version__ = '1.5.1' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-1.4.1/lmdb/__main__.py new/lmdb-1.5.1/lmdb/__main__.py --- old/lmdb-1.4.1/lmdb/__main__.py 2023-04-06 08:42:11.000000000 +0200 +++ new/lmdb-1.5.1/lmdb/__main__.py 2024-07-01 08:57:53.000000000 +0200 @@ -1,4 +1,4 @@ -# Copyright 2013 The py-lmdb authors, all rights reserved. +# Copyright 2013-2024 The py-lmdb authors, all rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted only as authorized by the OpenLDAP @@ -18,7 +18,7 @@ # Additional information about OpenLDAP can be obtained at # <http://www.openldap.org/>. -# Hack to support Python >=v2.6 'pythom -mlmdb' +# Hack to support Python >=v2.6 'python -mlmdb' from __future__ import absolute_import import lmdb.tool lmdb.tool.main() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-1.4.1/lmdb/cpython.c new/lmdb-1.5.1/lmdb/cpython.c --- old/lmdb-1.4.1/lmdb/cpython.c 2023-04-06 08:42:11.000000000 +0200 +++ new/lmdb-1.5.1/lmdb/cpython.c 2024-07-01 08:57:53.000000000 +0200 @@ -1,5 +1,5 @@ /* - * Copyright 2013 The py-lmdb authors, all rights reserved. + * Copyright 2013-2024 The py-lmdb authors, all rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted only as authorized by the OpenLDAP @@ -112,50 +112,12 @@ typedef struct TransObject TransObject; -/* ------------------------ */ -/* Python 3.x Compatibility */ -/* ------------------------ */ - -#if PY_MAJOR_VERSION >= 3 - # define MOD_RETURN(mod) return mod; # define MODINIT_NAME PyInit_cpython # define MAKE_ID(id) PyCapsule_New((void *) (1 + (id)), NULL, NULL) # define READ_ID(obj) (((int) (long) PyCapsule_GetPointer(obj, NULL)) - 1) -#else - -# define MOD_RETURN(mod) return -# define MODINIT_NAME initcpython - -# define MAKE_ID(id) PyInt_FromLong((long) id) -# define READ_ID(obj) PyInt_AS_LONG(obj) - -# define PyUnicode_InternFromString PyString_InternFromString -# define PyBytes_AS_STRING PyString_AS_STRING -# define PyBytes_GET_SIZE PyString_GET_SIZE -# define PyBytes_CheckExact PyString_CheckExact -# define PyBytes_FromStringAndSize PyString_FromStringAndSize -# define _PyBytes_Resize _PyString_Resize -# define PyMemoryView_FromMemory(x, y, z) PyBuffer_FromMemory(x, y) - -# ifndef PyBUF_READ -# define PyBUF_READ 0 -# endif - -/* Python 2.5 */ -# ifndef Py_TYPE -# define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) -# endif - -# ifndef PyVarObject_HEAD_INIT -# define PyVarObject_HEAD_INIT(x, y) \ - PyObject_HEAD_INIT(x) y, -# endif - -#endif - struct list_head { struct lmdb_object *prev; struct lmdb_object *next; @@ -649,11 +611,7 @@ PyErr_Format(PyExc_OverflowError, "Integer argument exceeds limit."); return -1; } -#if PY_MAJOR_VERSION >= 3 *l = PyLong_AsUnsignedLongLongMask(obj); -#else - *l = PyInt_AsUnsignedLongLongMask(obj); -#endif return 0; } @@ -2124,7 +2082,7 @@ }; size_t buffer_pos = 0, buffer_size = 8; - size_t key_size, val_size, item_size = 0; + size_t key_size = 0, val_size, item_size = 0; char *buffer = NULL; static PyObject *cache = NULL; @@ -3797,11 +3755,7 @@ static int append_string(PyObject *list, const char *s) { -#if PY_MAJOR_VERSION >= 3 PyObject *o = PyUnicode_FromString(s); -#else - PyObject *o = PyBytes_FromStringAndSize(s, strlen(s)); -#endif if(! o) { return -1; @@ -3862,7 +3816,6 @@ {0, 0, 0, 0} }; -#if PY_MAJOR_VERSION >= 3 static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, "cpython", @@ -3874,7 +3827,6 @@ NULL, NULL }; -#endif /** * Initialize and publish the LMDB built-in types. @@ -3985,11 +3937,7 @@ MODINIT_NAME(void) { PyObject *__all__; -#if PY_MAJOR_VERSION >= 3 PyObject *mod = PyModule_Create(&moduledef); -#else - PyObject *mod = Py_InitModule3("cpython", module_methods, ""); -#endif if(! mod) { MOD_RETURN(NULL); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-1.4.1/lmdb.egg-info/PKG-INFO new/lmdb-1.5.1/lmdb.egg-info/PKG-INFO --- old/lmdb-1.4.1/lmdb.egg-info/PKG-INFO 2023-04-06 08:42:17.000000000 +0200 +++ new/lmdb-1.5.1/lmdb.egg-info/PKG-INFO 2024-07-01 08:57:59.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: lmdb -Version: 1.4.1 +Version: 1.5.1 Summary: Universal Python binding for the LMDB 'Lightning' Database Home-page: http://github.com/jnwatson/py-lmdb/ Author: David Wilson @@ -9,10 +9,7 @@ Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy -Classifier: Programming Language :: Python :: 2 -Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 @@ -20,6 +17,7 @@ Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 Classifier: Topic :: Database Classifier: Topic :: Database :: Database Engines/Servers Description-Content-Type: text/plain diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-1.4.1/setup.py new/lmdb-1.5.1/setup.py --- old/lmdb-1.4.1/setup.py 2023-04-06 08:42:11.000000000 +0200 +++ new/lmdb-1.5.1/setup.py 2024-07-01 08:57:53.000000000 +0200 @@ -1,5 +1,5 @@ # -# Copyright 2013-2020 The py-lmdb authors, all rights reserved. +# Copyright 2013-2024 The py-lmdb authors, all rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted only as authorized by the OpenLDAP @@ -45,8 +45,8 @@ if os.getenv('LMDB_FORCE_CFFI') is not None: use_cpython = False -if sys.version[:3] < '2.7' or (3, 0) < sys.version_info[:2] < (3, 4): - sys.stderr.write('Error: py-lmdb requires at least CPython 2.7 or 3.4\n') +if (3, 0) < sys.version_info[:2] < (3, 5): + sys.stderr.write('Error: py-lmdb requires at CPython 3.5\n') raise SystemExit(1) # @@ -110,11 +110,11 @@ if sys.platform.startswith('win'): patchfile = 'lib' + os.sep + 'py-lmdb' + os.sep + 'env-copy-txn.patch' patchset = patch.fromfile(patchfile) - rv = patchset.apply(3, root=dest) + rv = patchset.apply(2, root=dest) if not rv: raise Exception('Applying patch failed') else: - rv = os.system('/usr/bin/patch -N -p3 -d build/lib < lib/py-lmdb/env-copy-txn.patch') + rv = os.system('patch -N -p3 -d build/lib < lib/py-lmdb/env-copy-txn.patch') if rv: raise Exception('Applying patch failed') @@ -206,10 +206,7 @@ "Programming Language :: Python", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", @@ -217,6 +214,7 @@ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Topic :: Database", "Topic :: Database :: Database Engines/Servers", ],
