(any)dbm module lacks a context manager

Terry Reedy tjreedy at udel.edu
Thu Jan 31 23:38:25 CET 2013


On 1/31/2013 2:03 PM, python.list at tim.thechases.com wrote:
> I don't know if this has been remedied in a more recent version than
> I've got on my box (Debian Stable), but it seems like it should work
> out of the box:
>
> Python 3.1.3 (r313:86834, Nov 28 2010, 10:01:07)
> [GCC 4.4.5] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import dbm
>>>> with dbm.open("mydb", 'c') as d:
> ...     d["hello"] = "world"
> ...
> Traceback (most recent call last):
>    File "<stdin>", line 1, in <module>
> AttributeError: '_dbm.dbm' object has no attribute '__exit__'
>
>
> I'm guessing it's an easy fix? (or even already fixed)

Go to our public tracker, enter 'dbm context manager' in the top search 
box, (change Status to 'don't care' in case there is a closed issue,) 
and you get one hit:
http://bugs.python.org/issue11287
(Awaiting response to most recent patch review.)

-- 
Terry Jan Reedy




More information about the Python-list mailing list