diff options
| author | Federico Caselli <cfederico87@gmail.com> | 2021-12-27 21:04:54 +0000 |
|---|---|---|
| committer | Gerrit Code Review <gerrit@ci3.zzzcomputing.com> | 2021-12-27 21:04:54 +0000 |
| commit | c5b8f2f88bb487ce9bd4aac6173c445fa307ae07 (patch) | |
| tree | e28194a1edb222b7de87126933c579db53e14bd0 /lib/sqlalchemy/sql/coercions.py | |
| parent | 9eb5e153c93b6a01f16453bd45b4bda9411fb414 (diff) | |
| parent | 13e6e5608898a2c85751372ba88d357e5b80fe3f (diff) | |
| download | sqlalchemy-c5b8f2f88bb487ce9bd4aac6173c445fa307ae07.tar.gz | |
Merge "Replace raise_ with raise from" into main
Diffstat (limited to 'lib/sqlalchemy/sql/coercions.py')
| -rw-r--r-- | lib/sqlalchemy/sql/coercions.py | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/lib/sqlalchemy/sql/coercions.py b/lib/sqlalchemy/sql/coercions.py index 38eed4d2a..9b8b4540c 100644 --- a/lib/sqlalchemy/sql/coercions.py +++ b/lib/sqlalchemy/sql/coercions.py @@ -280,7 +280,7 @@ class RoleImpl: if advice: msg += " " + advice - util.raise_(exc.ArgumentError(msg, code=code), replace_context=err) + raise exc.ArgumentError(msg, code=code) from err class _Deannotate: @@ -345,18 +345,15 @@ class _ColumnCoercions: def _no_text_coercion( element, argname=None, exc_cls=exc.ArgumentError, extra=None, err=None ): - util.raise_( - exc_cls( - "%(extra)sTextual SQL expression %(expr)r %(argname)sshould be " - "explicitly declared as text(%(expr)r)" - % { - "expr": util.ellipses_string(element), - "argname": "for argument %s" % (argname,) if argname else "", - "extra": "%s " % extra if extra else "", - } - ), - replace_context=err, - ) + raise exc_cls( + "%(extra)sTextual SQL expression %(expr)r %(argname)sshould be " + "explicitly declared as text(%(expr)r)" + % { + "expr": util.ellipses_string(element), + "argname": "for argument %s" % (argname,) if argname else "", + "extra": "%s " % extra if extra else "", + } + ) from err class _NoTextCoercion: |
