-
Notifications
You must be signed in to change notification settings - Fork 285
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
Python3 fixes for storage api #5453
Conversation
We're in a freeze period, and seeing how porting python code has been risky later, we've prepared a python3 branch where this can be safely merged to, I'm changing the base branch so it can be promptly merged. |
Ah, this brings a lot of commits into the base branch because it's quite out-of date, I've opened #5454 to merge all the commits independently of your changes |
Hm, I don't see why those 4 commits based on
|
This is because the PR was created before the feature/py3 branch included the commits maybe a rebase can work around this github issue? |
This is a redo of 48c8c3e, not touching `long` and `str`. `unicode` is only used in there for testing whether we have a string, so aliasing it to `str` is valid. OTOH we likely don't want to accept `bytes` where we accept `str` in python2, and `str` gets aliased to `bytes` in other areas of the code, so this might reveal issues in other places. Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
With this a "make test" after build out of OPAM on Debian 12 finishes successfully. Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Reported-by: Pau Ruiz Safont <pau.ruizsafont@cloud.com> Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
eb0210b
to
af3a3e4
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## feature/py3 #5453 +/- ##
=============================================
+ Coverage 49.0% 55.8% +6.7%
=============================================
Files 18 15 -3
Lines 2319 2032 -287
=============================================
- Hits 1138 1135 -3
+ Misses 1181 897 -284 see 5 files with indirect coverage changes
Flags with carried forward coverage won't be shown. Click here to find out more. |
Codecov doesn't seem to make sense here, this PR did not change I wonder whether coverage could be calculated when running |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ydirson / @liulinC : Regarding the failed coverage check in this PR:
---> Rebasing it to the tip of the target branch feature/py3
should help.
Because it's targeted at the branch feature/py3
, I add an approval for testing it there!
Regarding coverage, I'm copying this here from #5511 (as Pau asked if it is possible to cover it):
The
xapi-storage
Python script self-tests are started from
ocaml/xapi-storage-script/main.ml
, and I do not understand it good enough to see how to make changes to invoke thecoverage
module instead of the script.
python -m coverage run scripts/examples/python/shell.py
Pau found: https://coverage.readthedocs.io/en/7.4.4/subprocess.html
Create or append to sitecustomize.py to add these lines:
import coverage
coverage.process_startup()
Create a .pth file in your Python installation containing:
import coverage; coverage.process_startup()
8a72e0f introduced a similar updates, and 1d05a6f revert it. But,
|
@liulinC can you have a look into how to progress this conversion to python 3? I believe it's worthwhile that the conversion team at the very least tracks progress of this in a ticket so it can be progressed however it's convenient. |
The previous changes was not a correct conversion and broke the product. This was detected in internal testing. |
Thanks, merge now for further test. |
This is a remake of #5375
It limits messing with the builtins, by only defining on py3 the missing
long
andunicode
as aliases where needed.