Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug: delegate parameter doesn't call its source to get value #6671

Merged
merged 3 commits into from
Nov 28, 2024

Conversation

picarro-yren
Copy link
Contributor

@picarro-yren picarro-yren commented Nov 27, 2024

Bug description:
A DelegateParameter should redirect to its source for the value but instead <function Parameter.init.._get_manual_parameter> is called and 0.0 is returned.

Cause
The reason why DelegateParameter doesn't call its source for the value is because of the following lines in Parameter.init:

elif not self.gettable and get_cmd is not False:
      if get_cmd is None:
                self.get_raw = MethodType(_get_manual_parameter, self)

When external_parameter is created, its source is None so it's not gettable and its get_raw is thus bound to _get_manual_parameter.

Solution
It turns out that even though gettable property of DelegateParameter is False when source is None, _gettable attribute is True because get_raw is defined in parameter

So the solution we propose is to use _gettable attribute instead of gettable property in Parameter.init.

@picarro-yren picarro-yren requested a review from a team as a code owner November 27, 2024 22:10
Copy link

codecov bot commented Nov 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.37%. Comparing base (ba45309) to head (b677c47).
Report is 12 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6671   +/-   ##
=======================================
  Coverage   69.37%   69.37%           
=======================================
  Files         340      340           
  Lines       31322    31328    +6     
=======================================
+ Hits        21729    21735    +6     
  Misses       9593     9593           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jenshnielsen jenshnielsen added this pull request to the merge queue Nov 28, 2024
Merged via the queue into microsoft:main with commit 24bc674 Nov 28, 2024
18 checks passed
jenshnielsen added a commit to jenshnielsen/Qcodes that referenced this pull request Nov 28, 2024
…r_bug

Fix bug: delegate parameter doesn't call its source to get value
@jenshnielsen jenshnielsen mentioned this pull request Nov 28, 2024
jenshnielsen added a commit that referenced this pull request Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants