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

CA-389177: Fix yes/no input for Python2/XS8: revert to raw_input() on Python2 #87

Merged

Conversation

bernhardkaindl
Copy link
Collaborator

@bernhardkaindl bernhardkaindl commented Feb 23, 2024

Python2 input() is eqivalent to: eval(raw_input()), which was wrong for Python2. Fix it.

For reading input lines like y (without "quotes") from stdin, we need to use raw_input() on Python2.

AshwinH contributed this comment in his approval:
Documentation for this change :https://codeql.github.com/codeql-query-help/python/py-use-of-input/

@coveralls
Copy link

coveralls commented Feb 23, 2024

Pull Request Test Coverage Report for Build 8020102376

Details

  • 0 of 3 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.02%) to 90.724%

Totals Coverage Status
Change from base Build 8019830655: -0.02%
Covered Lines: 2054
Relevant Lines: 2264

💛 - Coveralls

Copy link

codecov bot commented Feb 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.29%. Comparing base (33b6d6e) to head (d0e569d).
Report is 16 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master      #87   +/-   ##
=======================================
  Coverage   88.29%   88.29%           
=======================================
  Files          18       18           
  Lines        2195     2196    +1     
=======================================
+ Hits         1938     1939    +1     
  Misses        257      257           
Flag Coverage Δ
python2.7 86.85% <66.66%> (-0.09%) ⬇️
python3.10.13 87.77% <100.00%> (+<0.01%) ⬆️

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

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

@bernhardkaindl bernhardkaindl force-pushed the fix-yesno-input-for-py2-xs8 branch from 31f1537 to 3120459 Compare February 23, 2024 05:25
Python2 `input()` is eqivalent to: `eval(raw_input())`, but we need
the raw_input() function in Python2, revert back to it.

For reading unqoute strings like `y` without "quotes" from stdin,
we need to use `raw_input()` on Python2.

Signed-off-by: Bernhard Kaindl <[email protected]>
ashwin9390
ashwin9390 previously approved these changes Feb 23, 2024
Copy link
Collaborator

Choose a reason for hiding this comment

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

@bernhardkaindl bernhardkaindl merged commit 9ba210f into xenserver:master Feb 23, 2024
5 checks passed
@bernhardkaindl bernhardkaindl changed the title Fix yes/no input for Python2/XS8: revert to raw_input() on Python2 CA-389177: Fix yes/no input for Python2/XS8: revert to raw_input() on Python2 Feb 23, 2024
@bernhardkaindl bernhardkaindl deleted the fix-yesno-input-for-py2-xs8 branch February 24, 2024 13:57
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.

4 participants