diff options
author | Federico Caselli <cfederico87@gmail.com> | 2021-12-18 11:11:49 +0100 |
---|---|---|
committer | Federico Caselli <cfederico87@gmail.com> | 2021-12-27 21:03:33 +0100 |
commit | 13e6e5608898a2c85751372ba88d357e5b80fe3f (patch) | |
tree | e6b277981ee9e7de3fdcbe1530d02601e8dce94f /lib/sqlalchemy/sql/lambdas.py | |
parent | d736f8bc4583f679167e4961f62f0fe1d318e4c4 (diff) | |
download | sqlalchemy-13e6e5608898a2c85751372ba88d357e5b80fe3f.tar.gz |
Replace raise_ with raise from
Change-Id: I7aaeb5bc130271624335b79cf586581d6c6c34c7
References: #4600
Diffstat (limited to 'lib/sqlalchemy/sql/lambdas.py')
-rw-r--r-- | lib/sqlalchemy/sql/lambdas.py | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/lib/sqlalchemy/sql/lambdas.py b/lib/sqlalchemy/sql/lambdas.py index 2256fb5a9..da1dbedbb 100644 --- a/lib/sqlalchemy/sql/lambdas.py +++ b/lib/sqlalchemy/sql/lambdas.py @@ -901,24 +901,21 @@ class AnalyzedCode: def _raise_for_uncacheable_closure_variable( self, variable_name, fn, from_=None ): - util.raise_( - exc.InvalidRequestError( - "Closure variable named '%s' inside of lambda callable %s " - "does not refer to a cacheable SQL element, and also does not " - "appear to be serving as a SQL literal bound value based on " - "the default " - "SQL expression returned by the function. This variable " - "needs to remain outside the scope of a SQL-generating lambda " - "so that a proper cache key may be generated from the " - "lambda's state. Evaluate this variable outside of the " - "lambda, set track_on=[<elements>] to explicitly select " - "closure elements to track, or set " - "track_closure_variables=False to exclude " - "closure variables from being part of the cache key." - % (variable_name, fn.__code__), - ), - from_=from_, - ) + raise exc.InvalidRequestError( + "Closure variable named '%s' inside of lambda callable %s " + "does not refer to a cacheable SQL element, and also does not " + "appear to be serving as a SQL literal bound value based on " + "the default " + "SQL expression returned by the function. This variable " + "needs to remain outside the scope of a SQL-generating lambda " + "so that a proper cache key may be generated from the " + "lambda's state. Evaluate this variable outside of the " + "lambda, set track_on=[<elements>] to explicitly select " + "closure elements to track, or set " + "track_closure_variables=False to exclude " + "closure variables from being part of the cache key." + % (variable_name, fn.__code__), + ) from from_ def _cache_key_getter_tracked_literal(self, fn, pytracker): """Return a getter that will extend a cache key with new entries |