This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: 2to3 benchmark not working under Python 3
Type: Stage: resolved
Components: Benchmarks Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: brett.cannon Nosy List: brett.cannon, collinwinter, pitrou, python-dev
Priority: normal Keywords: easy

Created on 2012-08-31 22:27 by brett.cannon, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (5)
msg169587 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2012-08-31 22:27
2to3 isn't (ironically) translating lib2to3 so that it can run under Python 3:

File "/Users/bcannon/Developer/repo/benchmarks_py3k/lib/2to3/lib2to3/fixes/fix_operator.py", line 89, in _check_method
    method = getattr(self, "_" + results["method"][0].value.encode("ascii"))

Might need to let Python 3 use its stdlib copy of lib2to3. Otherwise will need to come up with a way to have two copies of a library, one for Python 2 and another for Python 3, and then copy the right thing. Maybe a lib3 directory that is only copied over by make_perf3.sh?
msg169589 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-08-31 22:42
> Might need to let Python 3 use its stdlib copy of lib2to3. Otherwise
> will need to come up with a way to have two copies of a library, one
> for Python 2 and another for Python 3, and then copy the right thing.
> Maybe a lib3 directory that is only copied over by make_perf3.sh?

Sounds like a good idea.
Even better if you can find a 3.x copy of lib2to3 which is close the 2.x
one :-)
msg169591 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2012-08-31 23:20
On Fri, Aug 31, 2012 at 6:42 PM, Antoine Pitrou <report@bugs.python.org>wrote:

>
> Antoine Pitrou added the comment:
>
> > Might need to let Python 3 use its stdlib copy of lib2to3. Otherwise
> > will need to come up with a way to have two copies of a library, one
> > for Python 2 and another for Python 3, and then copy the right thing.
> > Maybe a lib3 directory that is only copied over by make_perf3.sh?
>
> Sounds like a good idea.
> Even better if you can find a 3.x copy of lib2to3 which is close the 2.x
> one :-)
>

I think short of copying the stdlib versions from Python 2.7 and 3.2 I
don't think there is much choice short of doing a 2to3+fixes translation
ourselves just to have a version that is as close to the same as possible.
But looking at the stdlib versions they are practically the same already
except that one uses StringIO and the other uses io.StringIO (and Python 3
doesn't need the encode() call that triggered this whole discussion). I
don't remember if StringIO or io.StringIO is faster in Python 2.6 and 2.7,
but based on that we can either leave it as-is or tweak it to use the other
just for benchmarking to make it even.
msg187956 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2013-04-28 03:29
Since lib3 now exists we should probably take advantage and just keep a translated, patched copy of 2to3 there to avoid this problem while keeping performance on an even keel for comparison.
msg188307 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-05-03 17:07
New changeset 66f168b468c3 by Brett Cannon in branch 'default':
#15834: Make 2to3 so it can actually be proper translated.
http://hg.python.org/benchmarks/rev/66f168b468c3
History
Date User Action Args
2022-04-11 14:57:35adminsetgithub: 60038
2013-05-03 17:08:16brett.cannonsetstatus: open -> closed
resolution: fixed
stage: needs patch -> resolved
2013-05-03 17:07:29python-devsetnosy: + python-dev
messages: + msg188307
2013-04-28 03:29:11brett.cannonsetmessages: + msg187956
2013-04-28 03:25:47brett.cannonsetkeywords: + easy
2013-03-26 18:01:21brett.cannonsetassignee: collinwinter -> brett.cannon
2012-08-31 23:20:05brett.cannonsetmessages: + msg169591
2012-08-31 22:42:24pitrousetmessages: + msg169589
2012-08-31 22:27:19brett.cannoncreate