[pypy-commit] pypy stdlib-2.7.8: Fixed sqlite3 tests
alex_gaynor
noreply at buildbot.pypy.org
Sun Aug 24 03:04:07 CEST 2014
Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: stdlib-2.7.8
Changeset: r73019:076c750b2635
Date: 2014-08-23 18:03 -0700
http://bitbucket.org/pypy/pypy/changeset/076c750b2635/
Log: Fixed sqlite3 tests
diff --git a/lib_pypy/_sqlite3.py b/lib_pypy/_sqlite3.py
--- a/lib_pypy/_sqlite3.py
+++ b/lib_pypy/_sqlite3.py
@@ -1369,15 +1369,18 @@
self.description = cursor.description
self.values = values
+ def __len__(self):
+ return len(self.values)
+
def __getitem__(self, item):
- if type(item) is int:
+ if isinstance(item, (int, long)):
return self.values[item]
else:
item = item.lower()
for idx, desc in enumerate(self.description):
if desc[0].lower() == item:
return self.values[idx]
- raise KeyError
+ raise IndexError("No item with that key")
def keys(self):
return [desc[0] for desc in self.description]
More information about the pypy-commit
mailing list