From 636a3b4e0bb65e149436fe7683a822c72ae2ec82 Mon Sep 17 00:00:00 2001 From: Bob Halley Date: Thu, 13 Aug 2020 15:02:39 -0700 Subject: [PATCH] set class and module properly for decorated immutable classes. --- dns/_immutable_attr.py | 4 ++++ dns/_immutable_ctx.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/dns/_immutable_attr.py b/dns/_immutable_attr.py index e858337f..9d76cdf2 100644 --- a/dns/_immutable_attr.py +++ b/dns/_immutable_attr.py @@ -63,4 +63,8 @@ def immutable(cls): @_immutable_init def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) + # make ncls have the same name and module as cls + ncls.__name__ = cls.__name__ + ncls.__qualname__ = cls.__qualname__ + ncls.__module__ = cls.__module__ return ncls diff --git a/dns/_immutable_ctx.py b/dns/_immutable_ctx.py index babdde00..f56864b7 100644 --- a/dns/_immutable_ctx.py +++ b/dns/_immutable_ctx.py @@ -57,4 +57,8 @@ def immutable(cls): @_immutable_init def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) + # make ncls have the same name and module as cls + ncls.__name__ = cls.__name__ + ncls.__qualname__ = cls.__qualname__ + ncls.__module__ = cls.__module__ return ncls -- 2.47.3