10347 git-pbchk requires more python3 fixes

Review Request #1429 — Created Feb. 6, 2019 and submitted

citrus
illumos-gate
master
10347
490faf0...
general
10347 git-pbchk requires more python3 fixes

Test built and ran a git-pbchk against the last 100 commits in gate using both python2 and python3.

wiedi
  1. Ship It!
  2. 
      
seeemef@mac.com
  1. I'm curious what the stack trace reads. I don't see it on the illumos bug.

    1. I'll expand the bug:

      Traceback (most recent call last):
        File "/build/illumos-omnios/usr/src/tools/proto/root_i386-nd/opt/onbld/bin/git-pbchk", line 389, in <module>
          main(os.path.basename(sys.argv[0]), sys.argv[1:])
        File "/build/illumos-omnios/usr/src/tools/proto/root_i386-nd/opt/onbld/bin/git-pbchk", line 381, in main
          pbchk(git_root(), parent_branch, None)
        File "/build/illumos-omnios/usr/src/tools/proto/root_i386-nd/opt/onbld/bin/git-pbchk", line 348, in pbchk
          run_checks(root, parent, cmds)
        File "/build/illumos-omnios/usr/src/tools/proto/root_i386-nd/opt/onbld/bin/git-pbchk", line 319, in run_checks
          output=s)
        File "/build/illumos-omnios/usr/src/tools/proto/root_i386-nd/opt/onbld/bin/git-pbchk", line 266, in cstyle
          check_continuation=True)
        File "/build/illumos-omnios/usr/src/tools/proto/root_i386-nd/opt/onbld/bin/../lib/python3.5/onbld/Checks/CStyle.py", line 55, in cstyle
          ret, tmpfile = processcheck('cstyle', options, fh, output)
        File "/build/illumos-omnios/usr/src/tools/proto/root_i386-nd/opt/onbld/bin/../lib/python3.5/onbld/Checks/ProcessCheck.py", line 63, in processcheck
          p.stdin.write(line)
      TypeError: a bytes-like object is required, not 'str'
      
  2. 
      
jlevon
  1. I don't understand what's going on here, can you please expand the bug? There's nothing obvious in the python docs as to 2to3 incompatibilities,
    and it's not clear why we need to open a binary file instead of parsing the text as utf-8 (And the opposite in the first bit)

    1. Yes, that was a poor bug, apologies. It has now been updated with the stacktrace and explanation of the fixes here.

    2. And for more context, from python documentation:

      Python distinguishes between binary and text I/O. Files opened in binary mode (including 'b' in the mode argument) return contents as bytes objects without any decoding. In text mode (the default), the contents of the file are returned as str, the bytes having been first decoded using a platform-dependent encoding or using the specified encoding if given.
      
  2. 
      
seeemef@mac.com
  1. Ship It!
  2. 
      
jlevon
  1. Ship It!
  2. 
      
citrus
Review request changed

Status: Closed (submitted)

Loading...