Repository navigation
Preserve Placeholder binding when currying partial objects - #653
Open
skyon0522-ai wants to merge 1 commit into
Open
skyon0522-ai wants to merge 1 commit into
skyon0522-ai wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #652.
On Python 3.14,
curryconcatenates a partial object's stored arguments as if they were a bound prefix. Forf(a, b, c)returning its arguments andbase = partial(f, Placeholder, 2),curry(base, 1)(3)consequently returns(3, 2, 1)instead of(1, 2, 3). Staged calls can raise before all arguments are supplied, and the reported signature drops the placeholder parameter.Use stdlib partial composition to fill the stored slots, and use the effective partial signature when checking remaining arguments and building the curried signature. Placeholder detection uses identity so ordinary argument equality is not invoked.
Regression coverage includes constructor binding,
bind, staged and idempotent currying, multiple interior slots, signature binding, ordinary argument equality, and propagation of a genuine function-bodyTypeError.Validation against
451af60dec590a6010e2babdbf391ea8f815122f, using pytest 9.1.1 on Windows:test_functoolz.pyandtest_serialization.pypassed all 57 tests. The package tests with--doctest-modulesthen passed 276 tests, skipped one existing doctest, and explicitly deselected one metadata test.git diff --checkpassed.The broader run deselected
toolz/tests/test_package.py::test_has_versionbecause this direct-source test environment has no installed Toolz distribution metadata. That test and an installed-distribution build were not validated. The reported runs reused an existing pytest/dependency environment without installing packages.