diff --git a/pytorch3d/implicitron/tools/config.py b/pytorch3d/implicitron/tools/config.py index 5e7cb2bf..3c2c4d88 100644 --- a/pytorch3d/implicitron/tools/config.py +++ b/pytorch3d/implicitron/tools/config.py @@ -746,7 +746,8 @@ def _get_type_to_process(type_) -> Optional[Tuple[Type, _ProcessType]]: return underlying = args[0] if args[1] is type(None) else args[1] # noqa: E721 if ( - issubclass(underlying, ReplaceableBase) + isinstance(underlying, type) + and issubclass(underlying, ReplaceableBase) and ReplaceableBase in underlying.__bases__ ): return underlying, _ProcessType.OPTIONAL_REPLACEABLE diff --git a/tests/implicitron/test_config.py b/tests/implicitron/test_config.py index fc3ccde0..6f238412 100644 --- a/tests/implicitron/test_config.py +++ b/tests/implicitron/test_config.py @@ -109,6 +109,7 @@ class TestConfig(unittest.TestCase): self.assertIsNone(gt(Optional[MainTest])) self.assertIsNone(gt(Tuple[Fruit])) self.assertIsNone(gt(Tuple[Fruit, Animal])) + self.assertIsNone(gt(Optional[List[int]])) def test_simple_replacement(self): struct = get_default_args(MainTest)