Python 3 compatibility#72
Open
tomassedovic wants to merge 2 commits into
Open
Conversation
This changes the syntax and semantics a bit so that the resulting code is compatible with Python 2.6, 2.7 and 3.3. These three versions are closer than any other 2/3 combination. 2.6 and 2.7 got a lot of syntax from 3 backported and 3.3 added the u'string' syntax to make porting easier. It mostly follows Armin Ronacher's suggestions: http://lucumr.pocoo.org/2013/5/21/porting-to-python-3-redux/ The tests are not ported yet, just the library and the examples. Signed-off-by: Tomas Sedovic <tomas@sedovic.cz>
inspect.ismethod behaves differently for Python 2 and 3 (and it seems that the Py2 behaviour we're relying on here is actually a bug): http://bugs.python.org/issue16851 I don't think we *need* to verify that the event is a method. As long as it has the `_event_name` attribute (which we only set in the decorator), things should just work. Signed-off-by: Tomas Sedovic <tomas@sedovic.cz>
jafd
added a commit
to jafd/tornadio2
that referenced
this pull request
Aug 16, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes issue #48. It was surprisingly straightforward.
A few things of note:
0. The aim was to have a single codebase that's compatible with both major versions.
u'string'literals in 3.3. As such, the code is not compatible with 2.5, 3.1 and 3.2. If that's alright with the community, I'd like to keep it that way because it makes it much easier to maintain. If it is a problem, we should come up with a consensus on the supported versions and I shall attempt to update this.masterso I don't test them on thepython3branch either. I'll look into it next week to see if there are genuine bugs or it's just an issue with my setup.I tried to follow Armin Ronacher's suggestions:
http://lucumr.pocoo.org/2013/5/21/porting-to-python-3-redux/
Please do try it out and let me know if you have any issues or concerns over the code.