Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue5792] Enable short float repr() on Solaris/x86

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

Nov 9, 2009, 2:43 AM

Post #1 of 21 (524 views)
Permalink
[issue5792] Enable short float repr() on Solaris/x86

Mark Dickinson <dickinsm [at] gmail> added the comment:

There are some related comments in issue #7281.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5792>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 9, 2009, 3:32 AM

Post #2 of 21 (506 views)
Permalink
[issue5792] Enable short float repr() on Solaris/x86 [In reply to]

Stefan Krah <stefan-usenet [at] bytereef> added the comment:

I can confirm that short float repr() is active and all float tests are
passed on this combination:

Ubuntu64bit -> KVM -> OpenSolaris32bit/Python3.2/gcc

----------
nosy: +skrah

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5792>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 9, 2009, 3:34 AM

Post #3 of 21 (508 views)
Permalink
[issue5792] Enable short float repr() on Solaris/x86 [In reply to]

Mark Dickinson <dickinsm [at] gmail> added the comment:

Stefan Krah mentions in the issue 7281 discussion that suncc supports
the C99 fenv functions. I'm not sure how to use these to set the x87
precision, though. (Setting the rounding mode is straightforward.)

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5792>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 9, 2009, 3:41 AM

Post #4 of 21 (507 views)
Permalink
[issue5792] Enable short float repr() on Solaris/x86 [In reply to]

Mark Dickinson <dickinsm [at] gmail> added the comment:

I see two alternatives:

(1) Use fesetenv. I don't know what the appropriate value to pass would
be though, or even whether solaris lets you use fesetenv to control the
x87 precision. It seems that its primary purpose is to set flags and traps.

(2) Use inline assembly, assuming that suncc supports this. This seems
simpler. It's just a matter of figuring out the syntax that suncc
expects for asm, and making sure the code is properly tested.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5792>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 9, 2009, 3:46 AM

Post #5 of 21 (508 views)
Permalink
[issue5792] Enable short float repr() on Solaris/x86 [In reply to]

Mark Dickinson <dickinsm [at] gmail> added the comment:

Looking at:

http://docs.sun.com/app/docs/doc/816-5172/fesetenv-3m

it seems that fesetenv isn't what we want here. It 'only installs the
state of the floating-point status flags represented through its argument'.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5792>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 9, 2009, 3:53 AM

Post #6 of 21 (506 views)
Permalink
[issue5792] Enable short float repr() on Solaris/x86 [In reply to]

Mark Dickinson <dickinsm [at] gmail> added the comment:

Stefan, is it possible that suncc already accepts the assembler syntax
used in Python/pymath.h (py3k or trunk) for the functions
_Py_get_387controlword and _Py_set_387controlword?

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5792>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 9, 2009, 4:17 AM

Post #7 of 21 (507 views)
Permalink
[issue5792] Enable short float repr() on Solaris/x86 [In reply to]

Changes by Mark Dickinson <dickinsm [at] gmail>:


----------
assignee: -> mark.dickinson

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5792>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 9, 2009, 4:51 AM

Post #8 of 21 (506 views)
Permalink
[issue5792] Enable short float repr() on Solaris/x86 [In reply to]

Stefan Krah <stefan-usenet [at] bytereef> added the comment:

The inline asm compiles, but I don't know how good the GNU inline asm
support is with suncc in general. I'm not a heavy user of suncc, I just
use it for testing.

That said, perhaps fesetprec works, too:

http://docs.sun.com/app/docs/doc/816-5172/fesetprec-3m

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5792>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 9, 2009, 5:33 AM

Post #9 of 21 (507 views)
Permalink
[issue5792] Enable short float repr() on Solaris/x86 [In reply to]

Mark Dickinson <dickinsm [at] gmail> added the comment:

Excellent! From a bit of searching, it looks as though this assembler
syntax works on icc as well, which is very good news.

Thanks for finding fesetprec as well. It's a shame this isn't standard
C. Oh well; maybe for C201X. I think I'd prefer to stick with the
inline assembly, since it seems that there's very little to do to make
this just work.

Next problem: when compiling with suncc, how do I detect (in the
configure script)

(1) that I'm using suncc, and
(2) whether the hardware is x86 or not (preferably excluding the case of
x86-64).

For gcc, configure.in is using:

if test -n "`$CC -dM -E - </dev/null | grep i386`"

to detect whether we're on x86. I guess it's too much to hope for that
this works for suncc as well.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5792>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 9, 2009, 6:02 AM

Post #10 of 21 (506 views)
Permalink
[issue5792] Enable short float repr() on Solaris/x86 [In reply to]

Mark Dickinson <dickinsm [at] gmail> added the comment:

fesetprec and fegetprec are at least semi-standard, it seems. They're
recommended in the C99 rationale (see page 121 of

http://www.open-std.org/jtc1/sc22/wg14/www/C99RationaleV5.10.pdf

).

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5792>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 9, 2009, 6:27 AM

Post #11 of 21 (501 views)
Permalink
[issue5792] Enable short float repr() on Solaris/x86 [In reply to]

Stefan Krah <stefan-usenet [at] bytereef> added the comment:

If gcc and suncc are present, ./configure chooses gcc and everything is
fine.

If only suncc is present, it's detected as cc. These tests should be
possible:

stefan [at] opensolari:~/svn/py3k$ cc -V
cc: Sun C 5.9 SunOS_i386 Patch 124868-07 2008/10/07
usage: cc [ options] files. Use 'cc -flags' for details
stefan [at] opensolari:~/svn/py3k$ if cc -V 2>&1 | grep -q 'SunOS_i386';
then echo yes; fi
yes
stefan [at] opensolari:~/svn/py3k$ uname -a
SunOS opensolaris 5.11 snv_101b i86pc i386 i86pc Solaris
stefan [at] opensolari:~/svn/py3k$ if uname -a | grep -q i386; then echo yes; fi
yes

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5792>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 9, 2009, 6:33 AM

Post #12 of 21 (502 views)
Permalink
[issue5792] Enable short float repr() on Solaris/x86 [In reply to]

Mark Dickinson <dickinsm [at] gmail> added the comment:

Thanks. uname looks like the way to go, then.

Is your copy of OpenSolaris running in 32-bit mode or 64-bit mode? Does
the mode make a difference to the output of uname, or is uname -p always
i386, regardless of the mode?

I think the configure test for the inline assembly should go ahead on
both x86 and x86-64: it seems likely that a 64-bit OS would be using
SSE2 instructions for floating-point (which would make setting and
getting the x87 control word unnecessary) instead of the x87 FPU, but I
don't know that for sure.

Actually, I guess I could just make that configure test unconditional.
It'll fail on non-x86 hardware, but that's no big deal.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5792>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 9, 2009, 6:45 AM

Post #13 of 21 (503 views)
Permalink
[issue5792] Enable short float repr() on Solaris/x86 [In reply to]

Mark Dickinson <dickinsm [at] gmail> added the comment:

Stefan, please could you test the attached patch (against py3k) with
suncc? With this patch, sys.float_repr_style should report 'short', and
'make test' should not produce any obviously float-related failures.

----------
keywords: +patch
Added file: http://bugs.python.org/file15299/sun_short_float_repr.patch

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5792>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 9, 2009, 6:55 AM

Post #14 of 21 (502 views)
Permalink
[issue5792] Enable short float repr() on Solaris/x86 [In reply to]

Stefan Krah <stefan-usenet [at] bytereef> added the comment:

My copy is 32-bit. I never installed a 64-bit version, but I strongly
assume that uname -p gives x86_64. BTW, uname -p works on Solaris, but
returns 'unknown' on my 64 bit Linux.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5792>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 9, 2009, 7:36 AM

Post #15 of 21 (501 views)
Permalink
[issue5792] Enable short float repr() on Solaris/x86 [In reply to]

Stefan Krah <stefan-usenet [at] bytereef> added the comment:

Tested the patch against an updated 3.2. repr-style is 'short', and I
did not see obvious float errors. In particular, test_float.py is
passed. I also did not see new compile warnings.

As for the other tests, the errors I get seem to be the same with or
without the patch. Any other tests I should watch out for apart from
test_float.py?

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5792>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 9, 2009, 8:32 AM

Post #16 of 21 (502 views)
Permalink
[issue5792] Enable short float repr() on Solaris/x86 [In reply to]

Mark Dickinson <dickinsm [at] gmail> added the comment:

Many thanks for testing this, Stefan! I'll tidy up the patch a little bit
and add a Misc/NEWS entry, then commit this.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5792>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 9, 2009, 8:37 AM

Post #17 of 21 (500 views)
Permalink
[issue5792] Enable short float repr() on Solaris/x86 [In reply to]

Mark Dickinson <dickinsm [at] gmail> added the comment:

> As for the other tests, the errors I get seem to be the same with or
> without the patch. Any other tests I should watch out for apart from
> test_float.py?

Well *ideally* you shouldn't be getting any test failures :-). But I
could imagine than running Solaris within a VM might cause some
problems. Which tests are failing?

Tests I'd be worried about for the float repr change include:
test_float, test_complex, test_math, test_cmath, test_ast, test_format,
test_marshal, test_pickle, test_json, test_builtin, test_capi.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5792>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 9, 2009, 9:54 AM

Post #18 of 21 (500 views)
Permalink
[issue5792] Enable short float repr() on Solaris/x86 [In reply to]

Stefan Krah <stefan-usenet [at] bytereef> added the comment:

The tests that you mention run o.k., except capi, but that looks harmless:

stefan [at] opensolari:~/svn/py3k/Lib/test# ../../python test_capi.py
test_instancemethod (__main__.CAPITest) ... ok

----------------------------------------------------------------------
Ran 1 test in 0.000s

OK
internal test_L_code
internal test_Z_code
internal test_capsule
internalTraceback (most recent call last):
File "test_capi.py", line 170, in <module>
test_main()
File "test_capi.py", line 130, in test_main
print("internal", name)
ImportError: No module named _curses



Tests that fail:

test_ascii_formatd, test_calendar, test_datetime, test_distutils,
test_email, test_httpservers, test_mailbox, test_multiprocessing,
test_os, test_pipes, test_platform, test_poll, test_popen, test_pty,
test_pydoc, test_quopri, test_select, test_signal, test_strftime,
test_strptime, test_subprocess, test_sys, test_tempfile, test_threading


A lot of these fail either due to the inability to allocate resources or
the fact that strftime appears to give weird results.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5792>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 9, 2009, 10:28 AM

Post #19 of 21 (485 views)
Permalink
[issue5792] Enable short float repr() on Solaris/x86 [In reply to]

Mark Dickinson <dickinsm [at] gmail> added the comment:

Is the test_ascii_formatd failure due to a failed 'from ctypes import
...'? That's the only failure that looks like it could be related.

Thanks for this.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5792>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 9, 2009, 1:09 PM

Post #20 of 21 (482 views)
Permalink
[issue5792] Enable short float repr() on Solaris/x86 [In reply to]

Stefan Krah <stefan-usenet [at] bytereef> added the comment:

Yes, test_ascii_formatd fails with 'ImportError: No module named _ctypes'.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5792>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 15, 2009, 5:49 AM

Post #21 of 21 (404 views)
Permalink
[issue5792] Enable short float repr() on Solaris/x86 [In reply to]

Mark Dickinson <dickinsm [at] gmail> added the comment:

Committed in r76300 (trunk) and r76301 (py3k). Thanks for all your help,
Stefan.

----------
resolution: -> fixed
stage: needs patch -> committed/rejected
status: open -> closed

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5792>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.