[qa] Refactor python2 syntax #7722

pull MarcoFalke wants to merge 4 commits into bitcoin:master from MarcoFalke:Mf1603-qaPy2/3 changing 62 files +326 −219
  1. MarcoFalke commented at 9:44 PM on March 19, 2016: member

    This will keep the #!/usr/bin/env python2 in all headers but prepare the syntax for python3. See #7717

    Again: This pull will not switch from py2 to py3 nor add full py3 compatibility; it will only make it easier to do either of those later.

  2. [qa] Use python2/3 syntax fa98f99b6c
  3. MarcoFalke force-pushed on Mar 19, 2016
  4. jonasschnelli added the label Tests on Mar 20, 2016
  5. [qa] Use print() in rpc tests fa52a6e50c
  6. [qa] rpc-tests: Properly use integer/float division dddd401168
  7. MarcoFalke force-pushed on Mar 20, 2016
  8. laanwj commented at 7:55 PM on March 20, 2016: member

    If you do this, please also add the appropriate __future__ imports on top of all files for full py2-3 compatiblity (see #7723):

    from __future__ import division,print_function,unicode_literals
    

    If you don't, e.g. print("a","b") will suddenly print a tuple on Python 2.x.

  9. MarcoFalke commented at 9:09 AM on March 21, 2016: member

    I think there seems to be some misunderstanding about this pulls scope: I am not adding support for python3 here. This is just refactoring within python2.

    There needs to be another pull which does either of the following:

    • full py2/3 compatibility, which I am not going to do and also advise others not to try. The maintanace burden is just too high and I think having the requirement of full py2/3 comp. will discourage new contributors.
    • switch to py3 eventually. I think this is the safest and least confusing option. I will prepare a pull for this next week.
  10. laanwj commented at 10:41 AM on March 21, 2016: member

    Yes, but for example, if you replace print a,b with print(a,b) you have to put from __future__ import print_function at the top. Otherwise this changes the behavior for Python2, which is unacceptable (for now at least).

  11. MarcoFalke commented at 11:05 AM on March 21, 2016: member

    I don't like the imports considering that they are about to get removed when we switch to py3. Also, I don't see an issue with printing a tuple in the two cases I left. Nonetheless, I changed it to print a string in the most recent commit...

  12. laanwj commented at 11:07 AM on March 21, 2016: member

    Also, I don't see an issue with printing a tuple in the two cases I left

    I just think it's ugly to print a tuple when it's not meant to.

    Using python3 print syntax without the appropriate future import is wrong - you don't get the actual functionality, while the developer is deceived into thinking it is - e.g. it also doesn't allow using end='' and file='' for example.

  13. MarcoFalke commented at 11:07 AM on March 21, 2016: member

    Extended test pass dddd401

  14. laanwj commented at 11:08 AM on March 21, 2016: member

    I don't like the imports considering that they are about to get removed when we switch to py3

    Fine, let's just put off merging this then until we're switching to py3 and dropping py2 support. I'm cannot guarantee that this is going to be soon, though, we haven't had any kind of discussion about doing so.

  15. MarcoFalke force-pushed on Mar 21, 2016
  16. MarcoFalke force-pushed on Mar 21, 2016
  17. MarcoFalke force-pushed on Mar 21, 2016
  18. MarcoFalke force-pushed on Mar 21, 2016
  19. [qa] Use division and print from __future__ fa8e2cdc95
  20. in qa/rpc-tests/abandonconflict.py:None in fa17370668 outdated
       0 | @@ -1,8 +1,10 @@
       1 |  #!/usr/bin/env python2
    


    jonasschnelli commented at 12:48 PM on March 21, 2016:

    Would speak something against using !/usr/bin/env python here


    laanwj commented at 12:52 PM on March 21, 2016:

    Let's not change these - I don't think there's a interpreter name that works on all distros and is still general, unfortunately. E.g., Ubuntu 16.04 would require an explicit python2.7 right now(see #7717).

    When the QA tests are ported to Python3 we can just make them all python3. That's explicitly not the goal of this pull though.

  21. MarcoFalke force-pushed on Mar 21, 2016
  22. MarcoFalke renamed this:
    [qa] Use python2/3 syntax
    [qa] Refactor python2 syntax
    on Mar 21, 2016
  23. laanwj commented at 9:56 AM on March 23, 2016: member

    utACK fa8e2cd

  24. MarcoFalke force-pushed on Mar 25, 2016
  25. MarcoFalke force-pushed on Mar 25, 2016
  26. MarcoFalke commented at 4:51 PM on March 31, 2016: member

    Removed the last commit, rebased, fixed some more bugs: See 7778

  27. MarcoFalke closed this on Mar 31, 2016

  28. MarcoFalke deleted the branch on Mar 31, 2016
  29. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 18:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me