Roundup Robot added the comment:
New changeset 200207e50cbf by R David Murray in branch 'default':
whatsnew: dbm.open is context manager. (#19282)
http://hg.python.org/cpython/rev/200207e50cbf
--
___
Python tracker rep...@bugs.python.org
Roundup Robot added the comment:
New changeset c2f1bb56760d by Nick Coghlan in branch 'default':
Close #19282: Native context management in dbm
http://hg.python.org/cpython/rev/c2f1bb56760d
--
nosy: +python-dev
resolution: - fixed
stage: patch review - committed/rejected
status: open -
Nick Coghlan added the comment:
Thanks Claudiu!
Additional tweaks in the committed version:
- added a paragraph to the docs about the with statement support and moved the
versionchanged note there
- changed the example in the docs to use a with statement
- added a basic test that the dumbdbm
Nick Coghlan added the comment:
I also changed the signature of the enter/exit methods to just use PyObject *
(rather than dbmobject *), since that allowed a bunch of casts to be removed
and eliminated a couple of compiler warnings about type mismatches.
--
Claudiu.Popa added the comment:
Cool, thanks!
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19282
___
___
Python-bugs-list mailing list
Nick Coghlan added the comment:
Patch looks reasonable to me - if nobody beats me to it, I'll commit this
before beta 1 :)
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19282
___
Claudiu.Popa added the comment:
There is issue19385 for the inconsistency of dbm.dumb, with a patch.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19282
___
Raymond Hettinger added the comment:
This seems like a reasonable request.
--
assignee: - ncoghlan
nosy: +ncoghlan, rhettinger
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19282
___
Claudiu.Popa added the comment:
Attached patch checks that the db is actually closed after the `with`. Also, I
noticed that dbm.dumb doesn't behave like the rest of the variants, as seen in
the following:
import dbm.dumb as d
db = d.open('test.dat', 'c')
db.close()
db.keys()
Traceback
Terry J. Reedy added the comment:
I agree with the revised title. Test_context_manager() should also test that db
is actually closed after the with statement. I presume you can use
self.assertRaises and try to do something with db that will fail if it is
properly closed.
with
10 matches
Mail list logo