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

python3 compatibility #19

Closed
wants to merge 2 commits into from
Closed

python3 compatibility #19

wants to merge 2 commits into from

Conversation

vukasin
Copy link

@vukasin vukasin commented May 21, 2014

Hi, I needed this to run on Python3.4. Most of the changes are automatic 2to3 but some needed to be hand tuned (see bucket.py)

@lericson
Copy link
Owner

Pretty sure this is supposed to work out of the box

  • Ludvig (phone)

On 21 maj 2014, at 10:13, Vukasin Toroman notifications@github.com wrote:

Hi, I needed this to run on Python3.4. Most of the changes are automatic 2to3 but some needed to be hand tuned (see bucket.py)

You can merge this Pull Request by running

git pull https://github.com/vukasin/simples3 master
Or view, comment on, or merge it at:

#19

Commit Summary

python3 compatibility
File Changes

M .gitignore (12)
M simples3/init.py (2)
M simples3/bucket.py (51)
M simples3/gae.py (12)
M simples3/streaming.py (4)
M simples3/utils.py (10)
M tests/init.py (24)
M tests/test_bucket.py (16)
M tests/test_streaming.py (6)
Patch Links:

https://github.com/lericson/simples3/pull/19.patch
https://github.com/lericson/simples3/pull/19.diff

Reply to this email directly or view it on GitHub.

@vukasin
Copy link
Author

vukasin commented May 21, 2014

well mostly it does. there are a few problems:

  1. the base64 in signing needs to be treated as binary as opposed to string (otherwise keys don’t work)
  2. there is a check for presence of the “iteritems” attribute which does not exist

I've added comments to the changes which are not generated by running 2to3

@@ -20,16 +20,16 @@ def __init__(self, d=None):
if not d:
return
if hasattr(d, "iteritems"):
d = d.iteritems()
Copy link

Choose a reason for hiding this comment

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

Use this block here:

if hasattr(d, 'iteritems):
   d = d.iteritems()
elif hasattr(d, 'items'):
  d = d.items()

Copy link
Author

Choose a reason for hiding this comment

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

good idea, that way python2 still uses iterators
On 23 May 2014, at 14:08, Arseny Nasokin notifications@github.com wrote:

In tests/init.py:

@@ -20,16 +20,16 @@ def init(self, d=None):
if not d:
return
if hasattr(d, "iteritems"):

  •        d = d.iteritems()
    
    Use this block here:

if hasattr(d, 'iteritems):
d = d.iteritems()
elif hasattr(d, 'items'):
d = d.items()

Reply to this email directly or view it on GitHub.

Copy link
Author

Choose a reason for hiding this comment

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

committed and pushed

allow both iteritems as well as items
@vukasin vukasin closed this Feb 5, 2021
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