msg121154 - (view) |
Author: Bobby Impollonia (bobbyi) |
Date: 2010-11-13 23:00 |
After checking out and converting the benchmark suite to py3k, the py3k benchmark set fails because of an ImportError in bm_pickle.py. Steps to reproduce: hg clone http://hg.python.org/benchmarks/ py2benchmarks mkdir py3benchmarks cd py3benchmarks ../py2benchmarks/make_perf3.sh ../py2benchmarks py3k perf.py -f -b py3k old_py3k new_py3k The ImportError comes from the new py2k/ py3k compatibility code. bm_pickle imports "long" from compat.py. However, when 2to3 is run, it changes the import line from saying "import ... long" to saying "import ... int", which fails because compat.py does not define "int". Is this a bug in lib2to3? I would not expect names used as lvalues to get converted. I'm using lib2to3 from python 2.6.5. A similar case is that the line unicode = str in compat.py gets changed by 2to3 to: str = str This isn't currently causing any problems because no one is trying to import "unicode" from compat, but if they did, they would fail on py3k. Regardless, a patch is attached that fixes bm_pickle by using "int_" as the name for our typedef instead of "long". |
|
|
msg121160 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2010-11-13 23:27 |
Well, since this benchmark is already 3.x compatible, there's not much sense in making a 2to3 pass, is there? So perhaps "make_perf3.sh" (which I've never used) should be a bit smarter. |
|
|
msg121164 - (view) |
Author: Bobby Impollonia (bobbyi) |
Date: 2010-11-13 23:41 |
Are there any files in performance/ that need 2to3? |
|
|
msg121165 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2010-11-13 23:44 |
> Are there any files in performance/ that need 2to3? All the ones that require external libs (such as django, spambayes, etc.). Although, of course, since they require external libs it's not sure the translation will work either. I think I've converted all the standalone benchmarks. You can select them by specifying "-b 2n3" to perf.py. |
|
|
msg121176 - (view) |
Author: Bobby Impollonia (bobbyi) |
Date: 2010-11-14 05:28 |
Patch is attached for make_perf3.sh to have it not convert things that don't need to be converted. This fixes the issue and with the patch all the py3k benchmarks run successfully after running the script. |
|
|
msg121177 - (view) |
Author: Bobby Impollonia (bobbyi) |
Date: 2010-11-14 06:31 |
Attached is a patch for perf.py that goes along with the previous patch for make_perf3.sh. This patch changes the py3k group to include everything in the 2n3 group since we can still run all those tests after converting. Previously, nqueens, unpack_sequance and richards weren't run as part of -b py3k |
|
|
msg121367 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2010-11-17 17:56 |
Pushed in 2c5c6d3f399b, thanks. |
|
|
msg121368 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2010-11-17 17:57 |
Woops, sorry, wrong issue. |
|
|
msg121370 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2010-11-17 18:02 |
Pushed in 92088733aade and 8dd7a860a2fa, thanks. |
|
|