Repository navigation
methodize: keep self before position-only params - #119
Merged
Merged
Conversation
func_to_method_func prepended the instance param with Sig addition, which sorts by kind and so put `self` after the `/` when the method kept a position-only param. The instance param is now position-only (and first) whenever the method signature has position-only params. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Closes #118.
func_to_method_func(and somethodize) prepended the instance param withinstance_arg_name + method_sig. Sig addition sorts by kind, so with a position-only param left in the method,selflanded after the/(e.g.def f(a, /, b)withmethodize(f, bind='b')gave(a, /, self), and calling it bound the wrong argument toself).The new
_prepend_instance_parammakesselfposition-only and first when the method signature has a position-only param; otherwise it keeps the previousinstance_arg_name + sigpath, so signatures without position-only params are unchanged.Tests: new
test_methodize_keeps_self_before_position_only_params(bind and default_from); full suite 870 passed, 2 xfailed. The second point of the issue (JSON-serializing anInstanceAttrDefaultdefault in front/py2http) is a separate check, filed as a follow-up.🤖 Generated with Claude Code
https://claude.ai/code/session_01N5aMHWyyR5mECim15Wv8kc