GitHub user kgiusti opened a pull request:
https://github.com/apache/qpid-dispatch/pull/305
Dispatch 965 - Port to Python 3.x
This patch is about as done as I can get it. Unit tests pass on 2.6, 2.7,
and 3.6.
Other than the fixups there are 2 major changes here:
1) using the __futures__ modules we're enabling python 3.x features in our
python 2.x environment. IOW your python 2.x interpreter will behave like a 3.x
interpreter in some cases. Reason: unless we're using both 2.x and 3.x
development environments we'll continue to break compatibility . Forcing us to
write python 3 compatible code in a python 2.x environment should help mitigate
the bit rot and keep us on track for when python 2.x is dropped in ~18 months.
Python 2.x behavior will change in the following ways:
- the print statement is disabled - only the print() function can be used
- all string literals are of the type unicode. So type('foo') is now
unicode, not str. If you need a binary literal string use the 'b' prefix ala
b'bintext'
- the division operator (/) now returns a **float** rather than an integer,
even if the types involved in the division are integer. IOW 4/5 now returns
0.8, not 0 (this is a nasty one - we need to be careful here)
- module inclusion is absolute unless '.' prefix is used - we've done this
for awhile so likely this won't make a difference.
2) added a python linter check to the unit tests
This will flag most other incompatible code changes to help avoid breaking
stuff. This new test runs under the tox environment. I urge you to install the
python-tox package so you can take advantage of this test.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/kgiusti/dispatch DISPATCH-965
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/qpid-dispatch/pull/305.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #305
----
commit 878534ec682b13cc731197318c8e6f32f06d6216
Author: Kenneth Giusti <kgiusti@...>
Date: 2018-04-11T21:24:23Z
DISPATCH-965: port python code to Python 3. Stay compatible with 2.6-7
commit 7bdd55c7db7b010f204750c0e39fbc067180d26a
Author: Kenneth Giusti <kgiusti@...>
Date: 2018-05-14T01:11:31Z
DISPATCH-965: fixups for Python 2.7 compatibility
commit fb363cb55411eb96667f63637d0a1cacb56df655
Author: Kenneth Giusti <kgiusti@...>
Date: 2018-05-16T00:56:12Z
DISPATCH-965: restrict tox version, fixup 2.6 issues
commit a5c40dae9ac1f075c98826f1e1305cb506669672
Author: Kenneth Giusti <kgiusti@...>
Date: 2018-05-16T17:12:12Z
DISPATCH-965: fix the 2.x fixes for 3.x
----
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]