Skip to content

Commit

Permalink
Improve python 3 detection logic
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanunderwood committed Jun 14, 2015
1 parent 8b1bf90 commit de135dd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
7 changes: 3 additions & 4 deletions rencode/rencode.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@

import sys

py3 = False
if sys.version_info.major >= 3:
py3 = True
py3 = sys.version >= '3'
if py3:
unicode = str

from cpython cimport bool
from libc.stdlib cimport realloc, malloc, free
from libc.string cimport memcpy
Expand Down
18 changes: 8 additions & 10 deletions rencode/rencode_orig.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,16 @@

import sys

py3 = False
if sys.version_info.major >= 3:
py3 = True
long = int
unicode = str

def int2byte(c):
if py3:
py3 = sys.version >= '3'
if py3:
long = int #@ReservedAssignment

This comment has been minimized.

Copy link
@aresch

aresch Jun 14, 2015

Owner

Can you please remove these comments or expand on them to explain their meaning?

This comment has been minimized.

Copy link
@jonathanunderwood

jonathanunderwood Jun 14, 2015

Author Contributor

Ah, yes, they're pydev (and IDE) specific annotations that slipped through.

How do you want me to deal with your requested changes - add more commits to this branch, or rework and re-push the branch (i think the comments might then get lost).

This comment has been minimized.

Copy link
@aresch

aresch Jun 14, 2015

Owner

Not sure.. I don't know github all that well ;). Whatever you can do to clean-up the couple issues -- I don't think preserving the comments is that important.

unicode = str #@ReservedAssignment
def int2byte(c):
return bytes([c])
else:
else:
def int2byte(c):
return chr(c)

import struct
from threading import Lock

Expand Down

0 comments on commit de135dd

Please sign in to comment.