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: Pickle benchmark fails after converting Benchmark Suite to py3k
Type: behavior Stage: resolved
Components: Benchmarks Versions: Python 3.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: collinwinter Nosy List: bobbyi, collinwinter, pitrou
Priority: normal Keywords: patch

Created on 2010-11-13 23:00 by bobbyi, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
compat.patch bobbyi, 2010-11-13 23:00 Patch for compat.py/ bm_pickle.py
make_perf3.patch bobbyi, 2010-11-14 05:28 patch for make_perf3.sh
perf.patch bobbyi, 2010-11-14 06:31 Have py3k group include 2n3 group
Messages (9)
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) * (Python committer) 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) * (Python committer) 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) * (Python committer) Date: 2010-11-17 17:56
Pushed in 2c5c6d3f399b, thanks.
msg121368 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-11-17 17:57
Woops, sorry, wrong issue.
msg121370 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-11-17 18:02
Pushed in 92088733aade and 8dd7a860a2fa, thanks.
History
Date User Action Args
2022-04-11 14:57:08adminsetgithub: 54620
2010-11-17 18:02:07pitrousetstatus: open -> closed
resolution: fixed
messages: + msg121370

stage: patch review -> resolved
2010-11-17 17:57:07pitrousetstatus: closed -> open
resolution: fixed -> (no value)
messages: + msg121368

stage: resolved -> patch review
2010-11-17 17:56:50pitrousetstatus: open -> closed
resolution: fixed
messages: + msg121367

stage: resolved
2010-11-14 06:31:45bobbyisetfiles: + perf.patch

messages: + msg121177
2010-11-14 05:28:44bobbyisetfiles: + make_perf3.patch

messages: + msg121176
2010-11-13 23:44:48pitrousetmessages: + msg121165
2010-11-13 23:41:18bobbyisetmessages: + msg121164
2010-11-13 23:27:15pitrousetmessages: + msg121160
2010-11-13 23:00:35bobbyicreate