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 2010年02月21日 15:44 by adam-collard, last changed 2022年04月11日 14:56 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| dbshelve_example.py | adam-collard, 2010年02月21日 17:14 | Simple example that generates traceback | ||
| dbshelve_dictmixin.patch | r.david.murray, 2010年02月21日 22:15 | |||
| Messages (8) | |||
|---|---|---|---|
| msg99667 - (view) | Author: Adam Collard (adam-collard) * | Date: 2010年02月21日 15:44 | |
Originally reported at: https://bugs.edge.launchpad.net/bugs/384602 In Python 2.6, the dbshelve.py module throws an AttributeError exception whenever a call is made to a method that depends upon an __iter__ method. The exception is: File "/usr/lib/python2.6/bsddb/dbshelve.py", line 167, in __iter__ return self.db.__iter__() AttributeError: 'DB' object has no attribute '__iter__' This means that, if mydb is an istance of a DB object, the following examples will fail: for key in mydb: print key print (k for k in mydb.iterkeys()) for k, d in mydb.itervalues(): print k, d and many other statements depending on iterable(mydb) being true Note that, in Python 2.5, these examples work and no exception is thrown. In fact, if you have both 2.5 and 2.6 installed on the same system, you can run the same program containing code as above with Python2.5 without issue while running it under Python 2.6 raises the exception seen above. |
|||
| msg99669 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2010年02月21日 16:49 | |
Could you please provide a complete example that demonstrates the problem? A naive example using shelve with a dbhash database seems to work fine. |
|||
| msg99672 - (view) | Author: Adam Collard (adam-collard) * | Date: 2010年02月21日 17:14 | |
Attached a simple example. |
|||
| msg99678 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2010年02月21日 20:09 | |
The bug seems to have been introduced by an incomplete or incorrect translation to the newer idiom (DictMixin to MutableMapping). Since bsddb is gone in py3, I'm inclined to fix it by just going back to using DictMixin. There are no tests for the DictMixin functionality added in Python 2.3. |
|||
| msg99692 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2010年02月21日 22:15 | |
Here's a patch. test_bsddb3 still passes with this patch applied on trunk. |
|||
| msg99832 - (view) | Author: Raymond Hettinger (rhettinger) * (Python committer) | Date: 2010年02月22日 21:07 | |
+1 |
|||
| msg99997 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2010年02月24日 02:38 | |
Committed to trunk in r78412 and 2.6 in r78413. |
|||
| msg101276 - (view) | Author: Jesús Cea Avión (jcea) * (Python committer) | Date: 2010年03月18日 19:50 | |
This bug was introduced in pybsddb 4.7.2, when migration to ABC (Abstract Base Classes). I have solved it in 4.8.3+, and added relevant testcases. I plan to integrate 4.8.3+ in Python 2.7. See issue8156. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:56:57 | admin | set | github: 52223 |
| 2010年03月18日 19:50:02 | jcea | set | messages: + msg101276 |
| 2010年02月24日 02:38:29 | r.david.murray | set | status: open -> closed resolution: fixed messages: + msg99997 stage: patch review -> resolved |
| 2010年02月22日 21:07:44 | rhettinger | set | nosy:
+ rhettinger messages: + msg99832 |
| 2010年02月21日 22:15:19 | r.david.murray | set | files:
+ dbshelve_dictmixin.patch messages: + msg99692 assignee: r.david.murray keywords: + patch stage: test needed -> patch review |
| 2010年02月21日 20:09:32 | r.david.murray | set | nosy:
+ jcea messages: + msg99678 components: + Library (Lib) keywords: + easy |
| 2010年02月21日 17:14:11 | adam-collard | set | files:
+ dbshelve_example.py messages: + msg99672 |
| 2010年02月21日 16:49:18 | r.david.murray | set | priority: normal type: behavior versions: + Python 2.6, Python 2.7 nosy: + r.david.murray messages: + msg99669 stage: test needed |
| 2010年02月21日 15:44:15 | adam-collard | create | |