From c6554ac52bfb7ce9ecd30ec777ce90adfe7861d2 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 20 Dec 2019 11:40:10 -0500 Subject: Copy bind_processors when altering for expanding IN Fixed issue where the collection of value processors on a :class:`.Compiled` object would be mutated when "expanding IN" parameters were used with a datatype that has bind value processors; in particular, this would mean that when using statement caching and/or baked queries, the same compiled._bind_processors collection would be mutated concurrently. Since these processors are the same function for a given bind parameter namespace every time, there was no actual negative effect of this issue, however, the execution of a :class:`.Compiled` object should never be causing any changes in its state, especially given that they are intended to be thread-safe and reusable once fully constructed. Fixes: #5048 Change-Id: I876d16bd7484eb05ce590397420552ac36da6e52 --- lib/sqlalchemy/engine/default.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/sqlalchemy/engine') diff --git a/lib/sqlalchemy/engine/default.py b/lib/sqlalchemy/engine/default.py index d1253f678..9eacf0527 100644 --- a/lib/sqlalchemy/engine/default.py +++ b/lib/sqlalchemy/engine/default.py @@ -773,6 +773,8 @@ class DefaultExecutionContext(interfaces.ExecutionContext): processors = compiled._bind_processors if compiled.literal_execute_params: + # copy processors for this case as they will be mutated + processors = dict(processors) positiontup = self._literal_execute_parameters( compiled, processors ) -- cgit v1.2.1