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 UnboundLocalError in aiida.cmdline.utils.edit_multiline_template #4436

Merged
merged 2 commits into from
Oct 26, 2020

Conversation

sphuber
Copy link
Contributor

@sphuber sphuber commented Oct 11, 2020

Fixes #4435

If click.edit returns a falsy value, the following conditional would
be skipped and the value variable would be undefined causing an
UnboundLocalError to be raised. This bug was reported by @blokhin but
the exact conditions under which it occurred are not clear.

If `click.edit` returns a falsy value, the following conditional would
be skipped and the `value` variable would be undefined causing an
`UnboundLocalError` to be raised. This bug was reported by @blokhin but
the exact conditions under which it occurred are not clear.
@codecov
Copy link

codecov bot commented Oct 11, 2020

Codecov Report

Merging #4436 into develop will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #4436      +/-   ##
===========================================
- Coverage    79.36%   79.36%   -0.00%     
===========================================
  Files          476      476              
  Lines        34950    34950              
===========================================
- Hits         27734    27733       -1     
- Misses        7216     7217       +1     
Flag Coverage Δ
#django 73.22% <100.00%> (+0.01%) ⬆️
#sqlalchemy 72.45% <100.00%> (-<0.01%) ⬇️

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

Impacted Files Coverage Δ
aiida/cmdline/utils/multi_line_input.py 95.46% <100.00%> (ø)
aiida/engine/daemon/client.py 72.42% <0.00%> (-1.14%) ⬇️
aiida/transports/plugins/local.py 82.83% <0.00%> (+0.26%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ee13ad6...2793df7. Read the comment docs.

@qiaojunfeng
Copy link
Contributor

I find one occurrence of this error, that is when setup a computer: when verdi asks for PREPEND_TEXT, and if I type :q for vi, the click.edit will return None, leading to this UnboundLocalError.

@sphuber
Copy link
Contributor Author

sphuber commented Oct 26, 2020

@chrisjsewell and @ramirezfranciscof this has been open for a while and needs to go in the next release. Would be good if any you two can review it.

Copy link
Member

@chrisjsewell chrisjsewell left a comment

Choose a reason for hiding this comment

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

Yep seems pretty trivial to me 👍

@sphuber sphuber merged commit 861a39f into aiidateam:develop Oct 26, 2020
@sphuber sphuber deleted the fix/4435/edit-multiline-template branch November 3, 2020 15:16
sphuber added a commit that referenced this pull request Nov 6, 2020
…te` (#4436)

If `click.edit` returns a falsy value, the following conditional would
be skipped and the `value` variable would be undefined causing an
`UnboundLocalError` to be raised. This bug was reported by @blokhin but
the exact conditions under which it occurred are not clear.

Cherry-pick: 861a39f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aiida.cmdline.utils.edit_multiline_template can raise UnboundLocalError
3 participants