Skip to content

Comments

fix: use enum.member#81

Merged
aazuspan merged 4 commits intoaazuspan:mainfrom
12rambau:fix-github-80
Aug 22, 2025
Merged

fix: use enum.member#81
aazuspan merged 4 commits intoaazuspan:mainfrom
12rambau:fix-github-80

Conversation

@12rambau
Copy link
Contributor

Fix #80

As suggested by the deprecation warning i wrapped the partial call into an enum.member. My understanding of the documentation is that it avoids bugs with self being implicitely ingected in the partial calls. by doing this I should maintain compatibility with the previous version of python and avoid the error with Python 3.13.

@aazuspan aazuspan added the bug Something isn't working label Aug 20, 2025
@aazuspan
Copy link
Owner

Thanks @12rambau! Unfortunately enum.member isn't available before 3.11, so we'll need a backwards compatible solution. Maybe something like the wrapper class mentioned in this answer?

class CallableEnumMember:
    def __init__(self, func):
        self._func = func

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

Or you could add some logic for checking the Python version and use partial or member depending - your call.

@aazuspan aazuspan mentioned this pull request Aug 20, 2025
Copy link
Owner

@aazuspan aazuspan left a comment

Choose a reason for hiding this comment

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

I rebased some fixes from main to get tests passing, but CI is failing to authenticate on a fork. Something I need to figure out. Everything passes locally, so I'll go ahead and merge.

Thanks!

@aazuspan aazuspan merged commit 73c0895 into aazuspan:main Aug 22, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deprecation warning for functools.partial in Python 3.13

2 participants