Author: Alex Gaynor <[email protected]>
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]
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit