Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Py3.8 staticmethod decorator no attribute __qualname__ #201

Open
hodgespodge opened this issue Dec 18, 2024 · 0 comments
Open

Py3.8 staticmethod decorator no attribute __qualname__ #201

hodgespodge opened this issue Dec 18, 2024 · 0 comments

Comments

@hodgespodge
Copy link
Contributor

Python 3.8 -- No issue for python 3.11
Plum 2.5.4 (and probably earlier versions)

from plum import dispatch

class myClass:
    
    @dispatch
    @staticmethod
    def myFunc(a: int, b: int) -> int:
        return a + b
    
out = myClass.myFunc(1, 2)
print(out)
  line 11, in myClass
    def myFunc(a: int, b: int) -> int:
  File "...\site-packages\plum\dispatcher.py", line 72, in __call__
    return self._add_method(method, None, precedence=precedence)
  File "...\site-packages\plum\dispatcher.py", line 138, in _add_method
    f = self._get_function(method)
  File "...\site-packages\plum\dispatcher.py", line 112, in _get_function
    if is_in_class(method):
  File "...\site-packages\plum\util.py", line 122, in is_in_class
    parts = f.__qualname__.split(".")
AttributeError: 'staticmethod' object has no attribute '__qualname__'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant