From: Bob Halley Date: Thu, 13 Aug 2020 22:02:39 +0000 (-0700) Subject: set class and module properly for decorated immutable classes. X-Git-Tag: v2.1.0rc1~81 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=636a3b4e0bb65e149436fe7683a822c72ae2ec82;p=thirdparty%2Fdnspython.git set class and module properly for decorated immutable classes. --- 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