Issue 1396678: bsddb.init causes error (original) (raw)

I've found an Error in the bsddb.init.py-module:

pythonversion = 2.4 (problem may also be in version 2.3)

After creating and closing a db with bsddb.hashopen I called globals(). Next there occured an Error:

#Error-Message

globals() {'builtins': <module '__builtin__' (built-in)>, 'f4': <function f4 at 0x00B5A130>, 'dbtest1': Traceback (most recent call last): File "", line 1, in ? File "D:\Programme\python24\lib\UserDict.py", line 162, in repr return repr(dict(self.iteritems())) File "", line 46, in iteritems File "", line 4, in _make_iter_cursor AttributeError: 'NoneType' object has no attribute 'cursor'


#Way of the Error The way of the Error is: 1. globals() asked for bsddb._DBWithCursor.repr with the repr-method inherriting from bsddb._iter_mixin based on UserDict.DictMixin. 2. The repr-method in UserDict.DictMixin at line 162 calls self.iteritems overwritten by bsddb._iter_mixin.iteritems at line 113. 3. This method calls self._make_iter_cursor (line 115). bsddb._iter_mixin._make_iter_cursor calls bsddb.db which was set to None at closing the bd with db.close() at line 223.

#Solution: That way the error was created. To avoid this, the bsddb._iter_mixin.iteritems-method should be something like this:

def iteritems(self): if not self.db: return "" try: cur = self._make_iter_cursor() ... ...