summaryrefslogtreecommitdiff
path: root/dns
diff options
context:
space:
mode:
authorBob Halley <halley@dnspython.org>2020-08-13 15:02:39 -0700
committerBob Halley <halley@dnspython.org>2020-08-13 15:02:39 -0700
commit636a3b4e0bb65e149436fe7683a822c72ae2ec82 (patch)
tree23c9301b6df6b17fc8ccbc8cca7d947b60231df5 /dns
parent665b61e1ff85f8904a0bb6d8780ff23759cadfb0 (diff)
downloaddnspython-636a3b4e0bb65e149436fe7683a822c72ae2ec82.tar.gz
set class and module properly for decorated immutable classes.
Diffstat (limited to 'dns')
-rw-r--r--dns/_immutable_attr.py4
-rw-r--r--dns/_immutable_ctx.py4
2 files changed, 8 insertions, 0 deletions
diff --git a/dns/_immutable_attr.py b/dns/_immutable_attr.py
index e858337..9d76cdf 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 babdde0..f56864b 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