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

fix python staticmethod #538

Merged
merged 2 commits into from
Sep 21, 2023
Merged

fix python staticmethod #538

merged 2 commits into from
Sep 21, 2023

Conversation

yoloyyh
Copy link
Collaborator

@yoloyyh yoloyyh commented Sep 17, 2023

Summary

This PR fixes/implements the following bugs/features

  • [ ✅] Bug 1
  • Bug 2
  • Feature 1
  • Feature 2
  • Breaking changes

#510

Fixes python staticmethod

@Hackerl
Copy link
Collaborator

Hackerl commented Sep 20, 2023

需要使用 self

    class StaticMethod(object):
        _func = staticmethod(smith_wrapper)

        def __call__(self, *args, **kwargs):
            return self._func(*args, **kwargs)

    return StaticMethod() if static else smith_wrapper

此处错误导致 func 实际是 smith_hook 的参数 func

Copy link
Collaborator

@Hackerl Hackerl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    class StaticMethod(object):
        _func = staticmethod(smith_wrapper)

        def __call__(self, *args, **kwargs):
            return self._func(*args, **kwargs)

    return StaticMethod() if static else smith_wrapper

@Hackerl Hackerl mentioned this pull request Sep 20, 2023
@yoloyyh yoloyyh merged commit 24e93a5 into main Sep 21, 2023
1 check passed
@yoloyyh yoloyyh deleted the fix-python-staticmethod branch December 28, 2023 12:20
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

Successfully merging this pull request may close these issues.

2 participants