diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-02-12 10:50:45 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-02-12 13:58:59 -0500 |
commit | 260ade78a70d51378de9e7b9456bfe6218859b6c (patch) | |
tree | d3e3f7805144a4dad0a113f4729b4dcad2538ee9 /lib | |
parent | 46b2d7ae6d630260acf4de32906a0cabced78d1c (diff) | |
download | sqlalchemy-260ade78a70d51378de9e7b9456bfe6218859b6c.tar.gz |
Raise and re-catch NameError from _ModNS
Fixed issue where using a fully qualified path for the classname in
:func:`_orm.relationship` that nonetheless contained an incorrect name for
path tokens that were not the first token, would fail to raise an
informative error and would instead fail randomly at a later step.
Fixes: #7697
Change-Id: I5e1a3aa4c2a6ea5b123be14666f589aec43f4b60
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sqlalchemy/orm/clsregistry.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/sqlalchemy/orm/clsregistry.py b/lib/sqlalchemy/orm/clsregistry.py index 3bf7ddde8..ac6b0fd4c 100644 --- a/lib/sqlalchemy/orm/clsregistry.py +++ b/lib/sqlalchemy/orm/clsregistry.py @@ -257,7 +257,7 @@ class _ModNS: else: assert isinstance(value, _MultipleClassMarker) return value.attempt_get(self.__parent.path, key) - raise AttributeError( + raise NameError( "Module %r has no mapped classes " "registered under the name %r" % (self.__parent.name, key) ) |