From 04fe33d64d2f4191a958de42729c2e69ce2faf5a Mon Sep 17 00:00:00 2001 From: Bartosz Dabrowski Date: Mon, 19 Aug 2024 15:18:15 +0200 Subject: [PATCH] Fixed bug in checking the existence of custom __init__ method in an object. The __init__ wasn't called previously. --- polymorphic/query.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/polymorphic/query.py b/polymorphic/query.py index 8e93281a..7d8636d1 100644 --- a/polymorphic/query.py +++ b/polymorphic/query.py @@ -73,7 +73,7 @@ def transmogrify(cls, obj): """ Upcast a class to a different type without asking questions. """ - if "__init__" not in obj.__dict__: + if "__init__" not in obj.__class__.__dict__: # Just assign __class__ to a different value. new = obj new.__class__ = cls