[issue11287] Add context manager support to dbm modules

2011-03-20 Thread Éric Araujo
Éric Araujo added the comment: Reviewed. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python

[issue11287] Add context manager support to dbm modules

2011-03-22 Thread Ray.Allen
Ray.Allen added the comment: patch updated. -- Added file: http://bugs.python.org/file21337/issue_11287.diff ___ Python tracker ___ _

[issue11287] Add context manager support to dbm modules

2011-03-22 Thread Éric Araujo
Éric Araujo added the comment: Looks good. Would someone else like to review too? I don’t know C, and there may be PEP 343 subtleties that I have missed. -- keywords: +needs review nosy: +ncoghlan stage: -> commit review ___ Python tracker

[issue11287] Add context manager support to dbm modules

2011-02-22 Thread Ray.Allen
New submission from Ray.Allen : dbm objects, including gdbm, ndbm, dumb, should support context manager. That is, can be used with 'with' keyword, just like regular file objects. I'm working out a patch for this. -- components: Extension Modules messages: 129076 nosy: ysj.ray priority:

[issue11287] Add context manager support to dbm modules

2011-02-22 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' : -- nosy: +giampaolo.rodola ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http:

[issue11287] Add context manager support to dbm modules

2011-02-24 Thread Ray.Allen
Ray.Allen added the comment: Here is the patch. -- keywords: +patch Added file: http://bugs.python.org/file20882/issue11287.diff ___ Python tracker ___ _

[issue11287] Add context manager support to dbm modules

2011-02-25 Thread Éric Araujo
Éric Araujo added the comment: +try: +with f: pass +except Exception as e: +self.assertIsInstance(e, ValueError) +else: +self.assertFailed() I find this form easier to read: with self.assertRaises(ValueError): with f:

[issue11287] Add context manager support to dbm modules

2011-02-25 Thread Ray.Allen
Ray.Allen added the comment: Update: change unittest code following eric's comments. -- Added file: http://bugs.python.org/file20902/issue11287.diff ___ Python tracker ___ _

[issue11287] Add context manager support to dbm modules

2012-11-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I added comments in Rietveld. -- nosy: +serhiy.storchaka stage: commit review -> needs patch ___ Python tracker ___ __

[issue11287] Add context manager support to dbm modules

2012-11-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I think it will be better to call the close() method from the __exit__() method using _PyObject_CallMethodId(). It will allow to overload the close() method and get working context manager without overloading the __exit__() method. See issue16488 for example