From dc171a930561e77d56a386b702193678369f882d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Czeka=C5=84ski?= Date: Wed, 10 Jan 2018 20:29:28 +0100 Subject: [PATCH] Fix legacy support (missing of_type variable) for _UnboundLoad.__setstate__ method While retrieving SqlAlchemy objects with dogpile cache stored by previous release (1.1.3) of SqlAlchemy exception UnboundLocalError was raised: ```UnboundLocalError: local variable 'of_type' referenced before assignment``` --- lib/sqlalchemy/orm/strategy_options.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/sqlalchemy/orm/strategy_options.py b/lib/sqlalchemy/orm/strategy_options.py index 13c5100475..1963e5843d 100644 --- a/lib/sqlalchemy/orm/strategy_options.py +++ b/lib/sqlalchemy/orm/strategy_options.py @@ -449,6 +449,7 @@ def __setstate__(self, state): if len(key) == 2: # support legacy cls, propkey = key + of_type = None else: cls, propkey, of_type = key prop = getattr(cls, propkey)