Skip to content

Commit

Permalink
Merge pull request #1483 from hrnciar/compatibility-with-python3.14
Browse files Browse the repository at this point in the history
Wrap functools.partial in staticmethod() to add compatibility with Python 3.14
  • Loading branch information
erezsh authored Jan 21, 2025
2 parents 5499f10 + 4809ce8 commit 95feb57
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 @@ -264,7 +264,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 @@ -365,8 +365,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 95feb57

Please sign in to comment.