Port from python 2.5-2.7 to 2.6-2.7/3.2+. #4

Merged
merged 1 commit into from Oct 31, 2012

Projects

None yet

2 participants

@abarnert
Contributor

NOTE: Breaks 2.5 compatibility!

  • Besides the trivial syntax changes, this required changing the
    Connection.write_line loop to keep _wbuffer as a flat bytes string
    instead of a list of strings. (Since it was already flattening each
    string and then exploding it into a list of 1-char strings, there's
    no performance downside to thsi change.)
  • As a side-effect of the changes, Connection.write and friends can
    now handle either bytes or unicode strings. Since the high-level
    methods are all in terms of JSON objects, this only really makes a
    difference for debugging bjsonrpc itself. (The json module will
    only give us str objects--bytes on 2.x, unicode on 3.x--and any
    non-ASCII characters will already be escaped for JSON anyway.)
@abarnert abarnert Port from python 2.5-2.7 to 2.6-2.7/3.2+.
- Besides the trivial syntax changes, this required changing the
  Connection.write_line loop to keep _wbuffer as a flat bytes string
  instead of a list of strings. (Since it was already flattening each
  string and then exploding it into a list of 1-char strings, there's
  no performance downside to thsi change.)

- As a side-effect of the changes, Connection.write and friends can
  now handle either bytes or unicode strings. Since the high-level
  methods are all in terms of JSON objects, this only really makes a
  difference for debugging bjsonrpc itself. (The json module will
  only give us str objects--bytes on 2.x, unicode on 3.x--and any
  non-ASCII characters will already be escaped for JSON anyway.)
bb21d28
@deavid deavid merged commit a7e13a7 into deavid:master Oct 31, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment