Skip to content

Commit

Permalink
Wrap functools.partial in staticmethod() to add compatibility with
Browse files Browse the repository at this point in the history
Python 3.14

Fixes: #1480
  • Loading branch information
hrnciar committed Nov 6, 2024
1 parent 24f19a3 commit 4809ce8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/test_trees.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def ab_method(self, a, b):
ab_partialmethod = partialmethod(ab_for_partialmethod, 1)
set_union = set(["a"]).union
static_add = staticmethod(add)
partial_reduce_mul = partial(reduce, mul)
partial_reduce_mul = staticmethod(partial(reduce, mul))

custom_callable = CustomCallable()

Expand Down Expand Up @@ -355,8 +355,8 @@ def test(prefix, s, postfix):

@v_args(inline=True)
class T(Transformer):
a = functools.partial(test, "@", postfix="!")
b = functools.partial(lambda s: s + "!")
a = staticmethod(functools.partial(test, "@", postfix="!"))
b = staticmethod(functools.partial(lambda s: s + "!"))

res = T().transform(tree)
assert res.children == ["@TEST1!", "test2!"]
Expand Down

0 comments on commit 4809ce8

Please sign in to comment.