Skip to content

Commit

Permalink
WIP testing solution
Browse files Browse the repository at this point in the history
  • Loading branch information
erezsh committed Aug 22, 2024
1 parent 0780925 commit 7ecb85c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion runtype/dataclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,8 @@ def __post_init__(self):
# __init__ may have been generated by the dataclass function
if hasattr(c, "__init__"):
# We will add it to the dispatch
c.__init__ = init_dispatcher(c.__init__)
# c.__init__ = init_dispatcher(c.__init__)
c.__init__ = init_dispatcher(c.__init__.__get__(cls))
else:
c.__init__ = init_f
return c
Expand Down
7 changes: 6 additions & 1 deletion runtype/dispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@ def __call__(self, func=None, *, priority=None):
"Must either provide a function to decorate, or set a priority"
)

fname = func.__qualname__
if hasattr(func, '__self__'):
fname = func.__self__.__qualname__ + "." + func.__name__
func = func.__func__
else:
fname = func.__qualname__

try:
tree = self.fname_to_tree[fname]
except KeyError:
Expand Down

0 comments on commit 7ecb85c

Please sign in to comment.