From 30b02003a70f37aa83e20de6229afe2a3600b648 Mon Sep 17 00:00:00 2001 From: Olivier Grisel Date: Wed, 25 Apr 2018 09:54:00 -0400 Subject: 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 --- lib/sqlalchemy/engine/base.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/sqlalchemy/engine') 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 = [] -- cgit v1.2.1