Merge lp:~gz/brz/py3_bencode_pyx into lp:brz
Proposed by
Martin Packman
Status: | Merged |
---|---|
Approved by: | Martin Packman |
Approved revision: | no longer in the source branch. |
Merge reported by: | The Breezy Bot |
Merged at revision: | not available |
Proposed branch: | lp:~gz/brz/py3_bencode_pyx |
Merge into: | lp:brz |
Prerequisite: | lp:~gz/brz/py3_static_tuple_import |
Diff against target: |
237 lines (+64/-54) 1 file modified
breezy/_bencode_pyx.pyx (+64/-54) |
To merge this branch: | bzr merge lp:~gz/brz/py3_bencode_pyx |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jelmer Vernooij | Approve | ||
Review via email: mp+326331@code.launchpad.net |
Commit message
Make _bencode_pyx compile and pass tests on Python 3
Description of the change
A bunch of changes to modern cython style, which gets us free aliasing of the PyBytes names and such like.
One of the few tricky bits is the Int/Long switching, which should be sane. On encode, it's just a fast path, so now uses bit_length() to check the size rather than just inferring from type. (Trivia, bit_length doesn't do 2's compliment.) On decode PyInt_FromString will promote to long on Python 2, and is always long on 3.
To post a comment you must log in.