Skip to content

[in progress] python 2 and 3 compatibility without 2to3, second try#2100

Merged
Carreau merged 6 commits into
ipython:masterfrom
Carreau:2to3fixes
Jul 13, 2012
Merged

[in progress] python 2 and 3 compatibility without 2to3, second try#2100
Carreau merged 6 commits into
ipython:masterfrom
Carreau:2to3fixes

Conversation

@Carreau

@Carreau Carreau commented Jul 5, 2012

Copy link
Copy Markdown
Member

After discussion in #2095, apply a smaller set of 2to3 fix.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since we're not disabling the print fixer, I think we should leave modules in external as they are for now.

@takluyver

Copy link
Copy Markdown
Member

Apart from the change to an IPython.external module, this looks OK.

@Carreau

Carreau commented Jul 5, 2012

Copy link
Copy Markdown
Member Author

I suggest we also apply/disable the raise fix, but this can be done later.

Converts raise E, V to raise E(V), and raise E, V, T to raise E(V).with_traceback(T). If E is a tuple, the translation will be incorrect because substituting tuples for exceptions has been removed in Python 3.

@takluyver

Copy link
Copy Markdown
Member

Yes, let's keep that for a separate pull request, so the diff doesn't get too big.

Note that the with_traceback(T) bit doesn't work in Python 2.7, so we need to be a little bit careful about applying that fix.

@fperez

fperez commented Jul 5, 2012

Copy link
Copy Markdown
Member

Should #2095 be closed, then?

@fperez

fperez commented Jul 5, 2012

Copy link
Copy Markdown
Member

Never mind, I just saw it had just slipped through the cracks, and closed #2095. Let's continue here.

For the record, I agree with the print_function policy of updating to the py3 style only when >> usage is being made and leaving plain prints alone for a bit longer. Something tells me py3.3 is going to be the 'tipping point' one for the migration, and we can reconsider more aggressive py3 changes at that point.

@Carreau

Carreau commented Jul 12, 2012

Copy link
Copy Markdown
Member Author

Merge a commit sent by @bfroehle to apply the raise fix, only in some places on top of this branch.
Are we trying to merge this before SciPy ? Otherwise we might have lots of conflict later...

@bfroehle

Copy link
Copy Markdown
Contributor

@Carreau: Maybe you should just squash the last two commits to preserve the history in deathrow/quarantine.

@takluyver

Copy link
Copy Markdown
Member

At a glance, this all looks OK. Don't forget to send the exception fix in external.decorators upstream.

@takluyver

Copy link
Copy Markdown
Member

Test results for commit 62e140b merged into master
Platform: linux2

  • python2.7: OK (libraries not available: oct2py rpy2)
  • python3.1: OK (libraries not available: cython matplotlib numpy oct2py pymongo qt rpy2 wx wx.aui zmq)
  • python3.2: OK (libraries not available: cython oct2py pymongo rpy2 wx wx.aui)

Not available for testing: python2.6

@bfroehle

Copy link
Copy Markdown
Contributor

Forwarded external.decorators upstream: numpy/numpy#353

@takluyver

Copy link
Copy Markdown
Member

Thanks. If there are no objections, merge away. I agree that we can squash the last 2 commits.

@bfroehle

Copy link
Copy Markdown
Contributor

Up next... next? has_key?

@takluyver

Copy link
Copy Markdown
Member

Sounds like a good idea, but let's do another pull request for it.

edited to avoid touching deathrow and quarantine by
Bussonnier Matthias <bussonniermatthias@gmail.com>
@Carreau

Carreau commented Jul 13, 2012

Copy link
Copy Markdown
Member Author

Squashed and force pushed,
merging.

Carreau added a commit that referenced this pull request Jul 13, 2012
python 2 and 3 compatibility without 2to3

apply some fixes :
- apply (deactivated in setup.py now)
- repr  (deactivated in setup.py now)
- print (only in modules with print >>)
- raise (partially) 

don't touch deathrow and quarantine.
@Carreau Carreau merged commit 0369b78 into ipython:master Jul 13, 2012
This was referenced Jul 13, 2012
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
python 2 and 3 compatibility without 2to3

apply some fixes :
- apply (deactivated in setup.py now)
- repr  (deactivated in setup.py now)
- print (only in modules with print >>)
- raise (partially) 

don't touch deathrow and quarantine.
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.

4 participants