Skip to content

Commit

Permalink
improve excp message for assert; bump version for release
Browse files Browse the repository at this point in the history
  • Loading branch information
oberstet committed Jul 3, 2022
1 parent c952f42 commit 0a69f82
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions zlmdb/_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import struct
import inspect
import time
from typing import Dict, Any

import lmdb
import yaml
Expand All @@ -58,7 +59,7 @@ def qual(klass):
'uuid-cbor': (MapUuidCbor, lambda x: x, lambda x: x),
}

_LMDB_MYPID_ENVS = {}
_LMDB_MYPID_ENVS: Dict[str, Any] = {}


class ConfigurationElement(object):
Expand Down Expand Up @@ -352,8 +353,10 @@ def __enter__(self):
# https://lmdb.readthedocs.io/en/release/#environment-class
if not self._is_temp:
if self._dbpath in _LMDB_MYPID_ENVS:
other = _LMDB_MYPID_ENVS[self._dbpath]
raise RuntimeError('tried to open same dbpath "{}" twice within '
'same process (PID {}) from {}'.format(self._dbpath, os.getpid(), self))
'same process (PID {}): cannot open for {}, already opened in {}'.format(
self._dbpath, os.getpid(), self, other))
_LMDB_MYPID_ENVS[self._dbpath] = self

# count number of retries
Expand Down
2 changes: 1 addition & 1 deletion zlmdb/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
#
###############################################################################

__version__ = '22.6.1.dev1'
__version__ = '22.6.1'

0 comments on commit 0a69f82

Please sign in to comment.