[New-bugs-announce] [issue10411] Pickle benchmark fails after converting Benchmark Suite to py3k

Bobby Impollonia report at bugs.python.org
Sun Nov 14 00:00:37 CET 2010

New submission from Bobby Impollonia <bobbyi at gmail.com>:

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".

assignee: collinwinter
components: Benchmarks
files: compat.patch
keywords: patch
messages: 121154
nosy: bobbyi, collinwinter, pitrou
priority: normal
severity: normal
status: open
title: Pickle benchmark fails after converting Benchmark Suite to py3k
type: behavior
versions: Python 3.2
Added file: http://bugs.python.org/file19598/compat.patch

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list