From e702fb772791c8ac8b1c658e1f7dc97b30f592c5 Mon Sep 17 00:00:00 2001 From: Robert Jordens Date: Fri, 3 Apr 2015 14:55:20 -0600 Subject: [PATCH] decorators: fix class/instance logic --- migen/fhdl/decorators.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/migen/fhdl/decorators.py b/migen/fhdl/decorators.py index 815d7fcd..b6e906cd 100644 --- a/migen/fhdl/decorators.py +++ b/migen/fhdl/decorators.py @@ -1,6 +1,7 @@ import warnings from migen.fhdl.structure import * +from migen.fhdl.module import Module from migen.fhdl.tools import insert_reset, rename_clock_domain class ModuleTransformer: @@ -40,10 +41,10 @@ class ModuleTransformer: return victim def __call__(self, victim): - try: - return self.wrap_class(victim) - except TypeError: + if isinstance(victim, Module): return self.wrap_instance(victim) + else: + return self.wrap_class(victim) @classmethod def adhoc(cls, i, *args, **kwargs): -- 2.30.2