]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
set class and module properly for decorated immutable classes.
authorBob Halley <halley@dnspython.org>
Thu, 13 Aug 2020 22:02:39 +0000 (15:02 -0700)
committerBob Halley <halley@dnspython.org>
Thu, 13 Aug 2020 22:02:39 +0000 (15:02 -0700)
dns/_immutable_attr.py
dns/_immutable_ctx.py

index e858337f068463cfce8d236d1105cc2803bf6faf..9d76cdf26fea686a90f9d3dfbacf300793484706 100644 (file)
@@ -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
index babdde0034d36433f8a6acb8a4a19ba3f4fd9b7c..f56864b7e3cb2c11a81c91fe63a488a492f874a0 100644 (file)
@@ -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