summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ext/indexable.py
diff options
context:
space:
mode:
authorJeong YunWon <jeong@youknowone.org>2016-07-03 21:45:15 +0900
committerMike Bayer <mike_mp@zzzcomputing.com>2016-07-05 18:24:47 -0400
commit5a2d2f47d6681ce3085f4d4e4a8d384eb442c96f (patch)
tree05dd2d817e6a0339ecaaba9db7f635b0b91a3d4d /lib/sqlalchemy/ext/indexable.py
parent7c8c124dbe71602daed471e43af45051c5626c09 (diff)
downloadsqlalchemy-5a2d2f47d6681ce3085f4d4e4a8d384eb442c96f.tar.gz
`index_property` catches IndexError as well as KeyError
It was raising AttributeError for key accessing in dict, but raising IndexError for index accessing in array. Change-Id: I58a2252a9e8d7f78cabcefcbe7223a4f3a729115
Diffstat (limited to 'lib/sqlalchemy/ext/indexable.py')
-rw-r--r--lib/sqlalchemy/ext/indexable.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/sqlalchemy/ext/indexable.py b/lib/sqlalchemy/ext/indexable.py
index 5002e9beb..7d6348524 100644
--- a/lib/sqlalchemy/ext/indexable.py
+++ b/lib/sqlalchemy/ext/indexable.py
@@ -284,7 +284,7 @@ class index_property(hybrid_property): # noqa
raise AttributeError(self.attr_name)
try:
value = column_value[self.index]
- except KeyError:
+ except (KeyError, IndexError):
raise AttributeError(self.attr_name)
else:
return value