diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-03-14 14:34:36 -0700 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-03-14 14:34:36 -0700 |
| commit | 7ad0c8cb2b76c1de223787785cf5c77d43192db2 (patch) | |
| tree | 982a78930cc21b60c02d1cbfb7782b9bd8873cc7 /lib/sqlalchemy/cextension | |
| parent | 667f8f83fe2d41a7b53d854b3dbc45bd2cd9fbb0 (diff) | |
| download | sqlalchemy-7ad0c8cb2b76c1de223787785cf5c77d43192db2.tar.gz | |
- [bug] Fixed issue whereby attribute-based
column access on a row would raise
AttributeError with non-C version,
NoSuchColumnError with C version. Now
raises AttributeError in both cases.
[ticket:2398]
Diffstat (limited to 'lib/sqlalchemy/cextension')
| -rw-r--r-- | lib/sqlalchemy/cextension/resultproxy.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/sqlalchemy/cextension/resultproxy.c b/lib/sqlalchemy/cextension/resultproxy.c index 325007c11..3494ccae6 100644 --- a/lib/sqlalchemy/cextension/resultproxy.c +++ b/lib/sqlalchemy/cextension/resultproxy.c @@ -353,7 +353,16 @@ BaseRowProxy_getattro(BaseRowProxy *self, PyObject *name) else return tmp; - return BaseRowProxy_subscript(self, name); + tmp = BaseRowProxy_subscript(self, name); + if (tmp == NULL && PyErr_ExceptionMatches(PyExc_KeyError)) { + PyErr_Format( + PyExc_AttributeError, + "Could not locate column in row for column '%.200s'", + PyString_AsString(name) + ); + return NULL; + } + return tmp; } /*********************** |
