Skip to content

python 3.2/3.3 compatibility #36

Merged
merged 2 commits into from Mar 18, 2013

2 participants

@benoitc
benoitc commented Jan 9, 2013

add python 3 support. Tested on python 3.3/3.2 with all transports.

@mrjoes mrjoes and 1 other commented on an outdated diff Jan 9, 2013
sockjs/tornado/util.py
+
+PY3 = sys.version_info[0] == 3
+
+if PY3:
+ string_types = str,
+ integer_types = int,
+ class_types = type,
+ text_type = str
+ binary_type = bytes
+
+ MAXSIZE = sys.maxsize
+
+ def bytes_to_str(b):
+ if isinstance(b, text_type):
+ return b
+ return str(b, 'latin1')
@mrjoes
Owner
mrjoes added a note Jan 9, 2013

Why it is latin1?

@benoitc
benoitc added a note Jan 9, 2013

fixed. should be unicode there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@mrjoes mrjoes commented on an outdated diff Jan 9, 2013
sockjs/tornado/static.py
+ print(data)
@mrjoes
Owner
mrjoes added a note Jan 9, 2013

Whoops

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@mrjoes mrjoes referenced this pull request Jan 23, 2013
Closed

Python 3 support #13

@mrjoes mrjoes merged commit 3f04471 into mrjoes:master Mar 18, 2013
@mrjoes
Owner
mrjoes commented Mar 18, 2013

Sorry for delay, was quite busy lately.

Changeset was merged and passes all sockjs-protocol tests on both python 2 and 3. There was problem with custom websocket protocol implementation, so I decided to stick with customized base Tornado version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.