commit python-lmdb for openSUSE:Factory

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 2022-01-31 22:57:12 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-lmdb (Old) and /work/SRC/openSUSE:Factory/.python-lmdb.new.1898 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-lmdb" Mon Jan 31 22:57:12 2022 rev:9 rq:950092 version:1.3.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-lmdb/python-lmdb.changes 2021-04-21 20:59:50.042242417 +0200 +++ /work/SRC/openSUSE:Factory/.python-lmdb.new.1898/python-lmdb.changes 2022-01-31 22:57:55.825335746 +0100 @@ -1,0 +2,9 @@ +Mon Jan 31 06:49:57 UTC 2022 - Mia Herkt <mia@0x0.st> + +- Update to v1.3.0 +* Add Python 3.10 support. +* Fix crash relating to caching of transactions. + The 'max_spare_txns' parameter to Environment/open is currently + ignored. + +------------------------------------------------------------------- Old: ---- lmdb-1.2.1.tar.gz New: ---- lmdb-1.3.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-lmdb.spec ++++++ --- /var/tmp/diff_new_pack.hXUrI2/_old 2022-01-31 22:57:56.285332649 +0100 +++ /var/tmp/diff_new_pack.hXUrI2/_new 2022-01-31 22:57:56.289332622 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-lmdb # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-lmdb -Version: 1.2.1 +Version: 1.3.0 Release: 0 Summary: Universal Python binding for the LMDB 'Lightning' Database License: OLDAP-2.8 ++++++ lmdb-1.2.1.tar.gz -> lmdb-1.3.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-1.2.1/ChangeLog new/lmdb-1.3.0/ChangeLog --- old/lmdb-1.2.1/ChangeLog 2021-04-19 21:10:32.000000000 +0200 +++ new/lmdb-1.3.0/ChangeLog 2021-12-30 18:36:40.000000000 +0100 @@ -1,3 +1,11 @@ +2021-12-30 v1.3.0 +* Add aarch64 architecture builds. Contributed by odidev. + +* Add Python 3.10 support. + +* Fix crash relating to caching of transactions. The 'max_spare_txns' + parameter to Environment/open is currently ignored. + 2021-04-19 v1.2.1 * Resolve CI bug where non-Linux wheels were not being published to PyPI. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-1.2.1/PKG-INFO new/lmdb-1.3.0/PKG-INFO --- old/lmdb-1.2.1/PKG-INFO 2021-04-19 21:10:55.101324800 +0200 +++ new/lmdb-1.3.0/PKG-INFO 2021-12-30 18:36:53.228389700 +0100 @@ -1,12 +1,11 @@ Metadata-Version: 2.1 Name: lmdb -Version: 1.2.1 +Version: 1.3.0 Summary: Universal Python binding for the LMDB 'Lightning' Database Home-page: http://github.com/jnwatson/py-lmdb/ Author: David Wilson Maintainer: Nic Watson -License: OpenLDAP BSD -Description: Universal Python binding for the LMDB 'Lightning' Database +License: OLDAP-2.8 Platform: UNKNOWN Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: Implementation :: CPython @@ -20,6 +19,11 @@ Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 Classifier: Topic :: Database Classifier: Topic :: Database :: Database Engines/Servers Description-Content-Type: text/plain +License-File: LICENSE + +Universal Python binding for the LMDB 'Lightning' Database + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-1.2.1/README.md new/lmdb-1.3.0/README.md --- old/lmdb-1.2.1/README.md 2021-04-19 21:10:32.000000000 +0200 +++ new/lmdb-1.3.0/README.md 2021-12-30 18:36:40.000000000 +0100 @@ -15,8 +15,3 @@ That said, this project will continue to support running on Python 2.7 until Github Actions remove support for it. -# Sponsored by The Vertex Project - -My current employer, [The Vertex Project](https://vertex.link/) is generously sponsoring my time to maintain py-lmdb. -If you're a developer and you like open source and systems programming in Python, check us out. If you're an -intelligence analyst, check out Vertex's Intelligence Analysis Platform, [Synapse](https://github.com/vertexproject/synapse). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-1.2.1/lmdb/__init__.py new/lmdb-1.3.0/lmdb/__init__.py --- old/lmdb-1.2.1/lmdb/__init__.py 2021-04-19 21:10:32.000000000 +0200 +++ new/lmdb-1.3.0/lmdb/__init__.py 2021-12-30 18:36:40.000000000 +0100 @@ -50,4 +50,4 @@ from lmdb.cffi import __all__ from lmdb.cffi import __doc__ -__version__ = '1.2.1' +__version__ = '1.3.0' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-1.2.1/lmdb/cffi.py new/lmdb-1.3.0/lmdb/cffi.py --- old/lmdb-1.2.1/lmdb/cffi.py 2021-04-19 21:10:32.000000000 +0200 +++ new/lmdb-1.3.0/lmdb/cffi.py 2021-12-30 18:36:40.000000000 +0100 @@ -1122,7 +1122,7 @@ :: >>> env = lmdb.open('/tmp/test', max_dbs=2) - >>> with env.begin(write=True) as txn + >>> with env.begin(write=True) as txn: ... txn.put('somename', 'somedata') >>> # Error: database cannot share name of existing key! diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-1.2.1/lmdb/cpython.c new/lmdb-1.3.0/lmdb/cpython.c --- old/lmdb-1.2.1/lmdb/cpython.c 2021-04-19 21:10:32.000000000 +0200 +++ new/lmdb-1.3.0/lmdb/cpython.c 2021-12-30 18:36:40.000000000 +0100 @@ -204,11 +204,8 @@ DbObject *main_db; /** 1 if env opened read-only; transactions must always be read-only. */ int readonly; - - /** Max free txns to keep on free_txn list. */ - int max_spare_txns; - /** Spare read-only transaction list head. */ - struct TransObject *spare_txns; + /** Spare read-only transaction . */ + struct MDB_txn *spare_txn; }; /** TransObject.flags bitfield values. */ @@ -240,8 +237,6 @@ /** Number of mutations occurred since start of transaction. Required to * know when cursor key/value must be refreshed. */ int mutations; - /** Next free read-only txn, or NULL. */ - struct TransObject *spare_next; }; /** lmdb.Cursor */ @@ -827,9 +822,11 @@ /* -------------------------------------------------------- */ static PyObject * -make_trans(EnvObject *env, DbObject *db, TransObject *parent, int write, int buffers) +make_trans(EnvObject *env, DbObject *db, TransObject *parent, int write, + int buffers) { MDB_txn *parent_txn; + MDB_txn *txn; TransObject *self; int flags; int rc; @@ -857,40 +854,36 @@ parent_txn = parent->txn; } - if((!write) && env->spare_txns) { - self = env->spare_txns; - DEBUG("found freelist txn; self=%p self->txn=%p", self, self->txn) - env->spare_txns = self->spare_next; + if(write && env->readonly) { + const char *msg = + "Cannot start write transaction with read-only environment."; + return err_set(msg, EACCES); + } - UNLOCKED(rc, mdb_txn_renew(self->txn)); + if((!write) && env->spare_txn) { + txn = env->spare_txn; + DEBUG("using cached txn", txn) + env->spare_txn = NULL; + UNLOCKED(rc, mdb_txn_renew(txn)); if(rc) { - mdb_txn_abort(self->txn); - PyObject_Del(self); - return err_set("mdb_txn_begin", rc); - } - - env->max_spare_txns++; - self->flags &= ~TRANS_SPARE; - - } else { - MDB_txn *txn; - if(write && env->readonly) { - const char *msg = "Cannot start write transaction with read-only env"; - return err_set(msg, EACCES); + mdb_txn_abort(txn); + return err_set("mdb_txn_renew", rc); } - + } + else { flags = write ? 0 : MDB_RDONLY; UNLOCKED(rc, mdb_txn_begin(env->env, parent_txn, flags, &txn)); if(rc) { return err_set("mdb_txn_begin", rc); } + } - if(! ((self = PyObject_New(TransObject, &PyTransaction_Type)))) { - mdb_txn_abort(txn); - return NULL; - } - self->txn = txn; + if(! ((self = PyObject_New(TransObject, &PyTransaction_Type)))) { + mdb_txn_abort(txn); + return NULL; } + self->txn = txn; + OBJECT_INIT(self) LINK_CHILD(env, self) @@ -904,7 +897,6 @@ #endif self->mutations = 0; - self->spare_next = NULL; self->flags = 0; if(! write) { self->flags |= TRANS_RDONLY; @@ -1121,22 +1113,25 @@ static void trans_dealloc(TransObject *self); +static void +txn_abort(MDB_txn *txn); + static int env_clear(EnvObject *self) { - MDEBUG("killing env..") + MDB_txn * txn; + + MDEBUG("env_clear") INVALIDATE(self) self->valid = 0; Py_CLEAR(self->main_db); - /* Force trans_dealloc() to free by setting avail size to 0 */ - self->max_spare_txns = 0; - while(self->spare_txns) { - TransObject *cur = self->spare_txns; - MDEBUG("killing spare txn %p", self->spare_txns) - self->spare_txns = cur->spare_next; - trans_dealloc(cur); + txn = self->spare_txn; + if(txn) { + MDEBUG("killing spare txn %p", txn); + txn_abort(txn); + self->spare_txn = NULL; } if(self->env) { @@ -1242,8 +1237,7 @@ self->weaklist = NULL; self->main_db = NULL; self->env = NULL; - self->max_spare_txns = arg.max_spare_txns; - self->spare_txns = NULL; + self->spare_txn = NULL; if((rc = mdb_env_create(&self->env))) { err_set("mdb_env_create", rc); @@ -2130,7 +2124,7 @@ }; size_t buffer_pos = 0, buffer_size = 8; - size_t key_size, val_size, item_size; + size_t key_size, val_size, item_size = 0; char *buffer = NULL; static PyObject *cache = NULL; @@ -2280,6 +2274,7 @@ size_t newsize = buffer_pos * item_size; buffer = realloc(buffer, newsize); rc = PyBuffer_FillInfo(&pybuf, NULL, buffer, newsize, 0, PyBUF_SIMPLE); + // FIXME: check rc return PyMemoryView_FromBuffer(&pybuf); } else { return pylist; @@ -2291,7 +2286,7 @@ fail: if (buffer) { free(buffer); - }; + } return NULL; } @@ -3203,19 +3198,27 @@ /* Transactions */ /* ------------ */ +static void +txn_abort(MDB_txn *self) +{ + Py_BEGIN_ALLOW_THREADS + MDEBUG("aborting") + mdb_txn_abort(self); + Py_END_ALLOW_THREADS +} + + static int trans_clear(TransObject *self) { + MDEBUG("clearing trans") INVALIDATE(self) #ifdef HAVE_MEMSINK ms_notify((PyObject *) self, &self->sink_head); #endif if(self->txn) { - Py_BEGIN_ALLOW_THREADS - MDEBUG("aborting") - mdb_txn_abort(self->txn); - Py_END_ALLOW_THREADS + txn_abort(self->txn); self->txn = NULL; } MDEBUG("db is/was %p", self->db) @@ -3234,28 +3237,18 @@ static void trans_dealloc(TransObject *self) { + MDB_txn * txn = self->txn; if(self->weaklist != NULL) { MDEBUG("Clearing weaklist..") PyObject_ClearWeakRefs((PyObject *) self); } - if(self->env && self->txn && - (self->env->max_spare_txns > 0) && (self->flags & TRANS_RDONLY)) { + if(txn && self->env && !self->env->spare_txn && + (self->flags & TRANS_RDONLY)) { MDEBUG("caching trans") - if(! (self->flags & TRANS_SPARE)) { - MDEBUG("resetting") - mdb_txn_reset(self->txn); - self->flags |= TRANS_SPARE; - } - self->spare_next = self->env->spare_txns; - self->env->spare_txns = self; - self->env->max_spare_txns--; - Py_INCREF(self); - - Py_CLEAR(self->db); - UNLINK_CHILD(self->env, self) - Py_CLEAR(self->env); - return; + mdb_txn_reset(txn); + self->env->spare_txn = txn; + self->txn = NULL; } MDEBUG("deleting trans") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-1.2.1/lmdb/tool.py new/lmdb-1.3.0/lmdb/tool.py --- old/lmdb-1.2.1/lmdb/tool.py 2021-04-19 21:10:32.000000000 +0200 +++ new/lmdb-1.3.0/lmdb/tool.py 2021-12-30 18:36:40.000000000 +0100 @@ -272,33 +272,33 @@ def restore_cursor_from_fp(txn, fp, db): read = fp.read read1 = functools.partial(read, 1) - read_until = lambda sep: ''.join(iter(read1, sep)) # NOQA: E731 + read_until = lambda sep: b''.join(iter(read1, sep)) # NOQA: E731 rec_nr = 0 while True: rec_nr += 1 plus = read(1) - if plus == '\n': + if plus == b'\n': break - elif plus != '+': + elif plus != b'+': die('bad or missing plus, line/record #%d', rec_nr) try: - klen = int(read_until(','), 10) - dlen = int(read_until(':'), 10) + klen = int(read_until(b','), 10) + dlen = int(read_until(b':'), 10) except ValueError: die('bad or missing length, line/record #%d', rec_nr) key = read(klen) - if read(2) != '->': + if read(2) != b'->': die('bad or missing separator, line/record #%d', rec_nr) data = read(dlen) if (len(key) + len(data)) != (klen + dlen): die('short key or data, line/record #%d', rec_nr) - if read(1) != '\n': + if read(1) != b'\n': die('bad line ending, line/record #%d', rec_nr) txn.put(key, data, db=db) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-1.2.1/lmdb.egg-info/PKG-INFO new/lmdb-1.3.0/lmdb.egg-info/PKG-INFO --- old/lmdb-1.2.1/lmdb.egg-info/PKG-INFO 2021-04-19 21:10:48.000000000 +0200 +++ new/lmdb-1.3.0/lmdb.egg-info/PKG-INFO 2021-12-30 18:36:49.000000000 +0100 @@ -1,12 +1,11 @@ Metadata-Version: 2.1 Name: lmdb -Version: 1.2.1 +Version: 1.3.0 Summary: Universal Python binding for the LMDB 'Lightning' Database Home-page: http://github.com/jnwatson/py-lmdb/ Author: David Wilson Maintainer: Nic Watson -License: OpenLDAP BSD -Description: Universal Python binding for the LMDB 'Lightning' Database +License: OLDAP-2.8 Platform: UNKNOWN Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: Implementation :: CPython @@ -20,6 +19,11 @@ Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 Classifier: Topic :: Database Classifier: Topic :: Database :: Database Engines/Servers Description-Content-Type: text/plain +License-File: LICENSE + +Universal Python binding for the LMDB 'Lightning' Database + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-1.2.1/setup.py new/lmdb-1.3.0/setup.py --- old/lmdb-1.2.1/setup.py 2021-04-19 21:10:32.000000000 +0200 +++ new/lmdb-1.3.0/setup.py 2021-12-30 18:36:40.000000000 +0100 @@ -198,7 +198,7 @@ long_description_content_type="text/plain", author='David Wilson', maintainer='Nic Watson', - license='OpenLDAP BSD', + license='OLDAP-2.8', url='http://github.com/jnwatson/py-lmdb/', packages=['lmdb'], @@ -215,6 +215,7 @@ "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", "Topic :: Database", "Topic :: Database :: Database Engines/Servers", ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-1.2.1/tests/crash_test.py new/lmdb-1.3.0/tests/crash_test.py --- old/lmdb-1.2.1/tests/crash_test.py 2021-04-19 21:10:32.000000000 +0200 +++ new/lmdb-1.3.0/tests/crash_test.py 2021-12-30 18:36:40.000000000 +0100 @@ -280,8 +280,11 @@ txn2 = env.begin(write=False) self.assertRaises(lmdb.InvalidParameterError, txn2.cursor, db=db) +MINDBSIZE = 64 * 1024 * 2 # certain ppcle Linux distros have a 64K page size + if sys.version_info[:2] >= (3, 4): class MapResizeTest(unittest.TestCase): + def tearDown(self): testlib.cleanup() @@ -291,13 +294,26 @@ Increase map size and fill up database, making sure that the root page is no longer accessible in the main process. ''' - data = [i.to_bytes(4, 'little') for i in range(400)] - with lmdb.open(path, max_dbs=10, create=False, map_size=32000) as env: + with lmdb.open(path, max_dbs=10, create=False, map_size=MINDBSIZE) as env: env.open_db(b'foo') - env.set_mapsize(64000) - with env.begin(write=True) as txn: - for datum in data: - txn.put(datum, b'0') + env.set_mapsize(MINDBSIZE * 2) + count = 0 + try: + # Figure out how many keyvals we can enter before we run out of space + with env.begin(write=True) as txn: + while True: + datum = count.to_bytes(4, 'little') + txn.put(datum, b'0') + count += 1 + + except lmdb.MapFullError: + # Now put (and commit) just short of that + with env.begin(write=True) as txn: + for i in range(count - 100): + datum = i.to_bytes(4, 'little') + txn.put(datum, b'0') + else: + assert 0 def test_opendb_resize(self): ''' @@ -306,9 +322,9 @@ Would seg fault in cffi implementation ''' mpctx = multiprocessing.get_context('spawn') - path, env = testlib.temp_env(max_dbs=10, map_size=32000) + path, env = testlib.temp_env(max_dbs=10, map_size=MINDBSIZE) env.close() - env = lmdb.open(path, max_dbs=10, map_size=32000, readonly=True) + env = lmdb.open(path, max_dbs=10, map_size=MINDBSIZE, readonly=True) proc = mpctx.Process(target=self.do_resize, args=(path,)) proc.start() proc.join(5) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-1.2.1/tests/cursor_test.py new/lmdb-1.3.0/tests/cursor_test.py --- old/lmdb-1.2.1/tests/cursor_test.py 2021-04-19 21:10:32.000000000 +0200 +++ new/lmdb-1.3.0/tests/cursor_test.py 2021-12-30 18:36:40.000000000 +0100 @@ -302,7 +302,7 @@ self.c.value() minflts_after_value = resource.getrusage(resource.RUSAGE_SELF)[6] - epsilon = 20 + epsilon = 60 # Setting the position doesn't prefault the data assert minflts_after_key - minflts_before < epsilon diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-1.2.1/tests/env_test.py new/lmdb-1.3.0/tests/env_test.py --- old/lmdb-1.2.1/tests/env_test.py 2021-04-19 21:10:32.000000000 +0200 +++ new/lmdb-1.3.0/tests/env_test.py 2021-12-30 18:36:40.000000000 +0100 @@ -826,6 +826,7 @@ def tearDown(self): testlib.cleanup() + @unittest.skip('Temporarily removed this functionality') def test_none(self): _, env = testlib.temp_env(max_spare_txns=0) assert 0 == reader_count(env)
participants (1)
-
Source-Sync