[Python-Dev] Shorter float repr in Python 3.1?

Ned Deily nad at acm.org
Tue Apr 14 10:45:51 CEST 2009

In article <nad-D10AA9.19075613042009 at news.gmane.org>,
 Ned Deily <nad at acm.org> wrote:

> In article <49E3D34E.8040705 at trueblade.com>,
>  Eric Smith <eric at trueblade.com> wrote:
> > Before then, if anyone could build and test the py3k-short-float-repr 
> > branch on any of the following machines, that would be great:
> > 
> [...]
> > Something bigendian, like a G4 Mac
> I'll crank up some OS X installer builds and run them on G3 and G4 Macs 
> vs 32-/64- Intel.  Any tests of interest beyond the default regttest.py?

FIrst attempt was a fat (32-bit i386 and ppc) build on 10.5 targeted for 
10.3 and above; this is the similar to recent python.org OSX installers.  
The good news: on 10.5 i386, running the default regrtest, no signficant 
differences were noted from an installer built from the current main 
py3k head.

Bad news: the same build installed on a G4 running 10.5 hung hard in 
test_pow of test_builtin; a kill was needed to terminate python.  Same 
results on a G3 running 10.4. 

nad at pbg4:/Library/Frameworks/Python.framework/Versions/3.1$ bin/python 
-S lib/python3.1/test/regrtest.py -s -v test_builtin
test_abs (test.test_builtin.BuiltinTest) ... ok
test_all (test.test_builtin.BuiltinTest) ... ok
test_any (test.test_builtin.BuiltinTest) ... ok
test_ascii (test.test_builtin.BuiltinTest) ... ok
test_bin (test.test_builtin.BuiltinTest) ... ok
test_callable (test.test_builtin.BuiltinTest) ... ok
test_chr (test.test_builtin.BuiltinTest) ... ok
test_cmp (test.test_builtin.BuiltinTest) ... ok
test_compile (test.test_builtin.BuiltinTest) ... ok
test_delattr (test.test_builtin.BuiltinTest) ... ok
test_dir (test.test_builtin.BuiltinTest) ... ok
test_divmod (test.test_builtin.BuiltinTest) ... ok
test_eval (test.test_builtin.BuiltinTest) ... ok
test_exec (test.test_builtin.BuiltinTest) ... ok
test_exec_redirected (test.test_builtin.BuiltinTest) ... ok
test_filter (test.test_builtin.BuiltinTest) ... ok
test_general_eval (test.test_builtin.BuiltinTest) ... ok
test_getattr (test.test_builtin.BuiltinTest) ... ok
test_hasattr (test.test_builtin.BuiltinTest) ... ok
test_hash (test.test_builtin.BuiltinTest) ... ok
test_hex (test.test_builtin.BuiltinTest) ... ok
test_id (test.test_builtin.BuiltinTest) ... ok
test_import (test.test_builtin.BuiltinTest) ... ok
test_input (test.test_builtin.BuiltinTest) ... ok
test_isinstance (test.test_builtin.BuiltinTest) ... ok
test_issubclass (test.test_builtin.BuiltinTest) ... ok
test_iter (test.test_builtin.BuiltinTest) ... ok
test_len (test.test_builtin.BuiltinTest) ... ok
test_map (test.test_builtin.BuiltinTest) ... ok
test_max (test.test_builtin.BuiltinTest) ... ok
test_min (test.test_builtin.BuiltinTest) ... ok
test_neg (test.test_builtin.BuiltinTest) ... ok
test_next (test.test_builtin.BuiltinTest) ... ok
test_oct (test.test_builtin.BuiltinTest) ... ok
test_open (test.test_builtin.BuiltinTest) ... ok
test_ord (test.test_builtin.BuiltinTest) ... ok
test_pow (test.test_builtin.BuiltinTest) ... ^CTerminated

Stepping through some of test_pow from the interactive interpreter:

Python 3.1a2+ (py3k-short-float-repr, Apr 13 2009, 20:55:35) 
[GCC 4.0.1 (Apple Inc. build 5490)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> pow(0,0)
1                    <-- OK
>>> pow(2,30)
1073741824  <-- OK
>>> pow(0.,0)
^C^CTerminated   <-- float argument => python hung in CPU loop, killed

Then I tried a couple of random floats:

Python 3.1a2+ (py3k-short-float-repr, Apr 13 2009, 20:55:35) 
[GCC 4.0.1 (Apple Inc. build 5490)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 3.1
>>> 1.
Terminated  <-- kill needed

The same tests work fine on the intel Mac.

Just out of curiosity, I'll try to do the same build on the 10.4 ppc;  
there are occasionally a few differences noted in the build results.  
That won't be available until later today.

 Ned Deily,
 nad at acm.org

More information about the Python-Dev mailing list