This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2014年06月10日 18:31 by serhiy.storchaka, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| dbm_dumb_deprecations.patch | serhiy.storchaka, 2014年06月10日 18:31 | review | ||
| dbm_dumb_deprecations2.patch | serhiy.storchaka, 2016年06月19日 22:06 | review | ||
| Messages (9) | |||
|---|---|---|---|
| msg220185 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2014年06月10日 18:31 | |
Unlike to other dbm implementations, a dumpdbm database is always opened for update, and will be created if it does not exist. We can fix this discrepancy and implement common behavior for 'r' and 'w' modes, but this will change current behavior and some deprecation period is needed. Here is a patch (based on patch by Claudiu Popa, submitted in issue18039), which adds deprecation warnings for cases when current behavior differs from desired: invalid values for the flag parameter (will raise ValueError in future), opening non-existing database in 'r' or 'w' mode (will raise dbm.dumb.error), modifying a database opened for reading only (will raise dbm.dumb.error). This patch needs approving by other core developer. |
|||
| msg221212 - (view) | Author: Raymond Hettinger (rhettinger) * (Python committer) | Date: 2014年06月22日 01:35 | |
The core idea is reasonable. The patch overreaches by adding readonly warnings to __setitem__ and __delitem__ which will spew-out on every call (these could be ignored or set to warn once by the user but that is PITA). Minor nit. We have a little PEP-8 overkill on the string splits: + with self.assertWarnsRegex(DeprecationWarning, + "The database file is missing, the " + "semantics of the 'c' flag will " + "be used."): |
|||
| msg221448 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2014年06月24日 10:16 | |
Thanks Raymond for your attention. Readonly warnings are emitted only when dumpdbm database opened in read only mode. They will be turned into exceptions in future (3.6 or 3.7). Annoying warnings on changed in future operations is desirable effect. If you worry about performance hit of such checks, __setitem__ and __delitem__ are expensive operations doing file I/O. |
|||
| msg221490 - (view) | Author: Raymond Hettinger (rhettinger) * (Python committer) | Date: 2014年06月24日 20:10 | |
I'm not worries about the performance. I think the warnings and checks don't need to be there are all (API creep). AFAICT, this has never been requested or needed in the entire history of the dumbdbm. Your original goal of changing the default update mode is worthwhile. |
|||
| msg221500 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2014年06月24日 21:03 | |
The point is to make the API consistent. So if the other dbm modules raise an error when __setitem__/__delitem__ are called on an R/O db, then the warnings are appropriate (but should mention that this will be an error in the future). The warnings will only be printed once per run of python, unless I'm completely misremembering how deprecation warnings work. |
|||
| msg221521 - (view) | Author: Raymond Hettinger (rhettinger) * (Python committer) | Date: 2014年06月25日 04:12 | |
Feel free to ignore my advice and make unnecessary changes to a very old, stable API. |
|||
| msg242965 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2015年05月12日 11:47 | |
Warnings are not raised by default. They are raised only when the database is opened with the 'r' mode and then modified. The earlier we start deprecation period, the earlier we could add true "read-only" and "update existing" modes to dbm.dumb. |
|||
| msg268874 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2016年06月19日 22:06 | |
Patch updated. Added What's New entry. We already lost 2 years and the 3.5 release. I don't want to lost 3.6 too. |
|||
| msg269873 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2016年07月06日 09:22 | |
New changeset 62da75b29b29 by Serhiy Storchaka in branch 'default': Issue #21708: Deprecated dbm.dumb behavior that differs from common dbm https://hg.python.org/cpython/rev/62da75b29b29 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:04 | admin | set | github: 65907 |
| 2016年07月17日 08:38:20 | serhiy.storchaka | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2016年07月06日 09:22:17 | python-dev | set | nosy:
+ python-dev messages: + msg269873 |
| 2016年06月19日 22:06:08 | serhiy.storchaka | set | files:
+ dbm_dumb_deprecations2.patch versions: + Python 3.6, - Python 3.5 messages: + msg268874 assignee: serhiy.storchaka components: + Library (Lib) |
| 2015年05月12日 11:47:44 | serhiy.storchaka | set | messages: + msg242965 |
| 2014年06月25日 04:12:41 | rhettinger | set | assignee: rhettinger -> (no value) messages: + msg221521 |
| 2014年06月24日 21:03:41 | r.david.murray | set | messages: + msg221500 |
| 2014年06月24日 20:10:42 | rhettinger | set | messages: + msg221490 |
| 2014年06月24日 10:16:48 | serhiy.storchaka | set | messages: + msg221448 |
| 2014年06月22日 01:35:29 | rhettinger | set | messages: + msg221212 |
| 2014年06月21日 03:16:51 | rhettinger | set | assignee: serhiy.storchaka -> rhettinger nosy: + rhettinger |
| 2014年06月10日 18:31:22 | serhiy.storchaka | create | |