Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Ensure that param-array matching works correctly#1304

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
filmor merged 3 commits intopythonnet:masterfromfilmor:fix-params-index
Dec 10, 2020

Conversation

filmor
Copy link
Member

@filmorfilmor commentedDec 3, 2020
edited
Loading

What does this implement/fix? Explain your changes.

The previous matching code wasn't specific enough for param arrays, the count of parameters has to be exactly right.

Does this close any currently open issues?

#1302

Any other comments?

Checklist

Check all those that are applicable and complete.

  • Make sure to include one or more tests for your change
  • If an enhancement PR, please create docs and at best an example
  • Add yourself toAUTHORS
  • Updated theCHANGELOG

@codecov-io
Copy link

codecov-io commentedDec 3, 2020
edited
Loading

Codecov Report

Merging#1304 (13871f2) intomaster (f8c27a1) willnot change coverage.
The diff coverage isn/a.

Impacted file tree graph

@@           Coverage Diff           @@##           master    #1304   +/-   ##=======================================  Coverage   74.04%   74.04%           =======================================  Files           1        1             Lines         289      289           =======================================  Hits          214      214             Misses         75       75
FlagCoverage Δ
setup_windows74.04% <ø> (ø)

Flags with carried forward coverage won't be shown.Click here to find out more.


Continue to review full report at Codecov.

Legend -Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing data
Powered byCodecov. Last updatef8c27a1...13871f2. Read thecomment docs.

@lostmsu
Copy link
Member

Can you add a test with a mix of keyword and params array arguments?

@filmor
Copy link
MemberAuthor

I added some more tests, but three of them are failing. I commented them out for now and will try to fix them today.

Copy link
Member

@lostmsulostmsu left a comment
edited
Loading

Choose a reason for hiding this comment

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

Please, remove the commented out code first.

We can match n Python parameters to exactly n+1 C# parameters of whichthe last one is a param-array.Fixespythonnet#1302.
@filmorfilmor merged commit4133927 intopythonnet:masterDec 10, 2020
@filmorfilmor deleted the fix-params-index branchDecember 10, 2020 17:47
@christabellachristabella mentioned this pull requestDec 17, 2020
4 tasks
@@ -652,7 +652,7 @@ static Type TryComputeClrArgumentType(Type parameterType, IntPtr argument, bool
{
match = true;
}
else if (positionalArgumentCount < parameters.Length)
else if (positionalArgumentCount < parameters.Length && (!paramsArray || positionalArgumentCount == parameters.Length - 1))
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it would be useful to comment explicitly on what kind of cases would fall into this condition, or simplify the branching statements somehow (refactor the default arg logic in a separate method)? Just by reading this I'm guessing that this should take care of only the following 2 cases?

  1. when it's not aparams array but there are some default values we need to fill in
  2. when it's aparams array and exactly one parameter is missing

Maybe there are more?

Copy link
Contributor

Choose a reason for hiding this comment

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

Nevermind, actually I get it now! I also added an extra comment and renamed the variables for readability and consistency with the others parts of methodbinder in my PR:https://github.com/pythonnet/pythonnet/pull/1324/files#diff-237dc718ad5424f5476d2ebbbc4e5164c95901bd2a4c2daaf8ca6fc9f9d3a5fbR703-R704

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@christabellachristabellachristabella left review comments

@lostmsulostmsulostmsu approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@filmor@codecov-io@lostmsu@christabella

[8]ページ先頭

©2009-2025 Movatter.jp