Menu

#5617 Prepare for encoding changes in Python 3

Fixed
Enhancement
2019-11-29
2019-11-23
No

Prepare for encoding changes in Python 3

This is most of the remaining diff for porting to Python 3,
but this also works in Python 2.4 already (even though not
strictly needed).

Individual changes:
1. Encode strings before hashing

Python 3 requires "bytes-like objects". Apparently we can already
do so in Python 2, even though not needed for correctness.

  1. Submit bytes-like objects to processes

Encode strings before writing to input and decode result after reading
from output or error stream.

  1. Open midi and musicxml files in binary mode

Only decode once we are sure that the content is not compressed.

http://codereview.appspot.com/573280043

Discussion

  • Anonymous

    Anonymous - 2019-11-24
    • Description has changed:

    Diff:

    
    
    • Needs: -->
    • Patch: new --> review
     
  • Anonymous

    Anonymous - 2019-11-24

    Passes make, make check and a full make doc.

     
  • Anonymous

    Anonymous - 2019-11-25
    • Patch: review --> countdown
     
  • Anonymous

    Anonymous - 2019-11-25

    Patch on countdown for Nov 27th (note comments on Rietveld).

     
  • Anonymous

    Anonymous - 2019-11-28
    • Patch: countdown --> push
     
  • Anonymous

    Anonymous - 2019-11-28

    Patch counted down - please push.

     
  • Jonas Hahnfeld

    Jonas Hahnfeld - 2019-11-28
    • labels: --> Fixed_2_21_0
    • status: Started --> Fixed
    • Patch: push -->
     
  • Jonas Hahnfeld

    Jonas Hahnfeld - 2019-11-28

    pushed to staging as

    commit 8e91e66158343996515c838366bbf03a45b25a5b
    Author: Jonas Hahnfeld <hahnjo@hahnjo.de>
    Date:   Sat Nov 23 10:03:14 2019 +0100
    
        Issue 5617/3: Open midi and musicxml files in binary mode
    
        When reading input files, only decode once we are sure that the
        content is not compressed and is properly encoded with UTF-8.
    
    commit 66d03bf31fcefd482356d6afafa41212e8269ee9
    Author: Jonas Hahnfeld <hahnjo@hahnjo.de>
    Date:   Sat Nov 23 09:57:50 2019 +0100
    
        Issue 5617/2: Submit bytes-like objects to processes
    
        Encode strings before writing to input and decode result after reading
        from output or error stream.
    
    commit 80da1d8a2986a312323b18d654606ca1467f1cef
    Author: Jonas Hahnfeld <hahnjo@hahnjo.de>
    Date:   Sat Nov 23 09:48:27 2019 +0100
    
        Issue 5617/1: Encode strings before hashing
    
        Python 3 requires "bytes-like objects". Apparently we can already
        do so in Python 2, even though not needed for correctness.
    
     
  • Jonas Hahnfeld

    Jonas Hahnfeld - 2019-11-29

    Well no, my push has been rejected, so here are the updated hashes:

    commit c114c0444b62d3b3c8a12b0124f807218eeee859
    Author: Jonas Hahnfeld <hahnjo@hahnjo.de>
    Date:   Sat Nov 23 10:03:14 2019 +0100
    
        Issue 5617/3: Open midi and musicxml files in binary mode
    
        When reading input files, only decode once we are sure that the
        content is not compressed and is properly encoded with UTF-8.
    
    commit 92fe023174739455feb4c645e9aa2565a058dc1e
    Author: Jonas Hahnfeld <hahnjo@hahnjo.de>
    Date:   Sat Nov 23 09:57:50 2019 +0100
    
        Issue 5617/2: Submit bytes-like objects to processes
    
        Encode strings before writing to input and decode result after reading
        from output or error stream.
    
    commit 2dc93ea87a90ca5ccbbc85a9d4e01fc59ce3ee14
    Author: Jonas Hahnfeld <hahnjo@hahnjo.de>
    Date:   Sat Nov 23 09:48:27 2019 +0100
    
        Issue 5617/1: Encode strings before hashing
    
        Python 3 requires "bytes-like objects". Apparently we can already
        do so in Python 2, even though not needed for correctness.
    
     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.