summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
authorOlivier Grisel <olivier.grisel@ensta.org>2018-04-25 09:54:00 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2018-04-25 15:16:06 -0400
commit30b02003a70f37aa83e20de6229afe2a3600b648 (patch)
tree7b103601ff3bd9fce7f381aeee4621d6ae28fa87 /lib/sqlalchemy
parenta81468c45f317326032afd075e08ae5640b03ad8 (diff)
downloadsqlalchemy-30b02003a70f37aa83e20de6229afe2a3600b648.tar.gz
Fix reference leak in compiled cache
Fixed a reference leak issue where the values of the parameter dictionary used in a statement execution would remain referenced by the "compiled cache", as a result of storing the key view used by Python 3 dictionary keys(). Pull request courtesy Olivier Grisel. Change-Id: Icfb0f38111a165780f6dd3e4e3382a03df79ce26 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/441
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/engine/base.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py
index aa9358cd6..4a057ee59 100644
--- a/lib/sqlalchemy/engine/base.py
+++ b/lib/sqlalchemy/engine/base.py
@@ -1023,9 +1023,9 @@ class Connection(Connectable):
distilled_params = _distill_params(multiparams, params)
if distilled_params:
- # note this is usually dict but we support RowProxy
- # as well; but dict.keys() as an iterable is OK
- keys = distilled_params[0].keys()
+ # ensure we don't retain a link to the view object for keys()
+ # which links to the values, which we don't want to cache
+ keys = list(distilled_params[0].keys())
else:
keys = []