Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch up py3k support #21

Merged
merged 31 commits into from
Oct 4, 2015
Merged

Catch up py3k support #21

merged 31 commits into from
Oct 4, 2015

Conversation

stefanor
Copy link
Member

@stefanor stefanor commented Oct 4, 2015

Python 3 support has been neglected for a while. This gets all the upstream unit tests that pass on Python 2, to pass on Python 3.

def chr_(o):
if sys.version_info >= (3, 0, 0):
return bytes((o,))
return chr(o)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this not rather be:

if sys.version_info >= (3, 0, 0):
    def chr_(o):
         return bytes((o,))
else:
    chr_ = chr

@hodgestar
Copy link
Member

Left one niggly stylistic comment, otherwise 👍.

@@ -49,13 +51,14 @@ def save(surface, filename):
fn_normalized = filename.lower()
result = 0
# TODO: prep/unprep surface
if fn_normalized.endswith('bmp'):
if fn_normalized.endswith(as_bytes('bmp')):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need as_bytes here?

Don't we only support recent enough python 2 versions that we can just use b'bmp'?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was my first approach. But then I saw that we had as_bytes for this. I'm happy to remove as_bytes entirely.

@drnlm
Copy link
Member

drnlm commented Oct 4, 2015

👍

stefanor added a commit that referenced this pull request Oct 4, 2015
Catch up py3k support
@stefanor stefanor merged commit bd3f2e8 into master Oct 4, 2015
@stefanor stefanor deleted the py3k branch October 4, 2015 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants